Root > How to... > ...determine if EurekaLog is active or not?

...determine if EurekaLog is active or not?

Previous pageReturn to chapter overviewNext page   

We recommend to use IFDEF-checks, for example:



// Compiled with EurekaLog
CurrentEurekaLogOptions. // ...


Alternatively there are functions (in EBase unit) like:


function IsEurekaLogInstalled: Boolean;
function IsEurekaLogActive: Boolean;
function IsEurekaLogActiveInThread(const AThreadID: Cardinal = 0): Boolean;


EurekaLog is considered to be active (in other words: will do its work) only if all of the following are true:

EurekaLog was compiled in (EUREKALOG symbol was defined, EurekaLog's units were added, IsEurekaLogInstalled returns True);
EurekaLog is enabled globally (IsEurekaLogActive returns True);
EurekaLog is enabled in the current thread (IsEurekaLogActiveInThread returns True).


For example:


if IsEurekaLogActive and 
   IsEurekaLogActiveInThread then

  // EurekaLog is compiled in and is enabled
  raise Exception.Create('will be handled by EurekaLog')

  // EurekaLog is compiled in, but is disabled
  raise Exception.Create('will be handled by RTL/VCL');

// EurekaLog is not compiled in
raise Exception.Create('will be handled by RTL/VCL');



EBase unit can be included into any application - even without EurekaLog;
IsEurekaLogActive will return False when IsEurekaLogInstalled returns False, so it is usually not required to call IsEurekaLogInstalled.
By default, EurekaLog is enabled on startup for main thread only. You can enable EurekaLog for background threads.


You can also detect if EurekaLog was disabled during compilation by looking at output of your compilation:



IDE's Messages / Build window - this is output when EurekaLog is disabled



See also:

Send feedback... Build date: 2023-09-11
Last edited: 2023-08-09
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.

Permanent link to this article: