ITLogLibInitialize

 

int ITLogLibInitialize (const char* pAppName, const char* pConfigFile, const char* pLicenseKey);

 

Purpose:

§      initialize the logging library

 

Parameters:

§      pAppName (Input): The application name.

§      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:

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

§      0 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 ITLogLibGetLastErrorDescription().

 

Limitations:

§      Don’t use any ITLogLib-functions before the execution of main() or WinMain() begins.

§      Don’t call ITLogLibInitialize() 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)

 

Notes:

§      For generating and modifying logging configuration files (*.icf), use the ITConfigManager, shipped with iTech Logging.