A common usage case is have some features of EurekaLog disabled for production. For example, if you are using EurekaLog during development - you probably want memory checks enabled, as well as show detailed exception dialog with call stack by default. However, when compiling a production build - you probably want more user-friendly exception dialog and/or disabled memory checks/leaks.
This article will discuss the case when you want to have EurekaLog enabled in both Debug and Release build configurations, but with different settings. If you want EurekaLog to be enabled for Debug build configuration and be disabled for Release build configuration (or visa versa) - please, see How to enable EurekaLog for production, disable for development article instead.
Important Note: some features of EurekaLog can be automatically disabled if no debugger is present. For example, memory leaks and freeze/hang/deadlock detection. Therefore, if you are only interested in those features - you may not need to do anything at all. Just configure the features.
How to differentiate between development and production buildsDefault project configuration in modern IDEs has 3 build configurations defined:
The supposed meaning is using Debug build configuration for developing and using Release build configuration for production.
Default build configurations
You can also check current build configuration in your source code:
{$IFDEF DEBUG}
We recommend to follow that approach.
Important: you are supposed to configure Release build configuration for EurekaLog.
Note: if you are using old IDE without build configurations support - the alternative way would be to create two projects, which will include the same set of units and share the same project source (.dpr file). Assign one project to be a development project, and second project to be a production project. The example below would use modern IDE as an example.
Important: do not forget to make a full project rebuild (not just compile) when you have switched active build configuration.
How to use different EurekaLog settings for production (run-time)If you want to disable certain features of EurekaLog for production - you may easily do it in your source code without need to create an alternative settings. For example:
uses // Disable hangs detection DoneCheckFreeze;
This example assumes that EurekaLog's project settings contains common settings for both build configurations. For example, send settings are set up, hang detection is enabled, memory checks are enabled, etc.
Such approach may be not ideal. For example, it would be better if memory checks are disabled from the start, as disabling checks at run-time would not remove EurekaLog's memory filter shim. Or there may be a lot of settings that you want to be different. Or it may be easier for you to manage settings via UI.
Important: do not forget to make a full project rebuild (not just compile) when you have switched active build configuration.
How to use different EurekaLog settings for production (design-time)Anyway, you can create alternative settings, which should be used for your production builds. That way you don't need to write any code.
Now you should have the following in your project's folder:
Now you can compile your project:
Important: do not forget to make a full project rebuild (not just compile) when you have switched active build configuration.
If you want to learn more details - see Different EurekaLog settings for Debug and Release build configurations.
See also:
|