ITLogLib::Initialize

 

bool Initialize(

const char* pAppName, const char* pConfigFile,

const char* pLicenseKey

);

 

Purpose:

§      initialize the logging library

 

Parameters:

§      pAppName (Input): The application name. Currently not used.

§      pConfigSource (Input): The name of the logging configuration file (*.icf). If necessary, including path.
The path can be absolute or relative to the working directory of your application.

§      pLicenseKey (Input): The license key for logging library.

 

Actions:

§      loads the configuration file

§      opens the standard logchannel („StdLog") according to the settings in the configuration file

 

Return value:

§      true after successful initialization
You get this return value too if the logging library already was initialized before the call.

§      false if an error occurred

 

Possible errors (just for an impression; enumeration may be incomplete):

§      configuration file couldn’t be found

§      configuration file doesn’t contain an entry for the StdLog logchannel or this entry is incomplete

§      invalid license key

As always, in the case of an error a detailed error description can be got calling GetITLogLib().GetLastErrorDescription().

 

Limitations:

§      Don’t use GetITLogLib() before the execution of main() or WinMain() begins, that is, in the initialization of static objects.
Currently we are not sure if there is a guarantee that the
ITLogLib instance was already created at this point.

§      Don’t call GetITLogLib().Initialize() in the DllMain() function of a DLL project.
This seems to make trouble. Therefore, shift the initialization of the logging library into a DLL function directly called by the user of the DLL.
For instance you can:

§      introduce an initialization function that must be called by the user

or

§      use lazy initialization (check in every method, if initialization was already done, and if not, (try to) do it)