Including the API in your modules

To include the ITLogLib/Standard C++ API in a C++ module, just add the following line at its top:

 

#include <ITLogLib2StdCxx.h>

 

Note that we don’t recommend directly including ITLogLib2StdCxx.h in large projects in each C++ module. Therefore, please read the following tips and recommendations.

 

Tips:

·      Using the precompiled headers feature:
If your C++ compiler supports the precompiling of header files, you can include
ITLogLib2StdCxx.h in the precompiled header file of your project. In Visual C++, for instance, this is usually the file "stdafx.h". This way you don’t have to add the #include statement to all of your modules plus you get faster compile times.

·      Using an existing utility header file:
Even when you are not using precompiled headers you might already have a base header file similar to "stdafx.h" that is used in all or many of your implementation files. It is usually a file named "Utilities.h" or similar. Then you can add the
#include statement for ITLogLib2StdCxx.h to this header file.

 

Generally we recommend that you create a wrapper header file around ITLogLib2StdCxx.h, at least for projects which consist of many implementation modules (*.cpp files). This wrapper header file can include only ITLogLib2StdCxx.h, but usually it would include also other utilities.

 

Some advantages of this strategy are:

·      The wrapper header file is the right place to add your own logging utilities, like logging helper functions.

·      It allows you to upgrade to a higher version of iTech Logging without changing hundreds of #include-directives, as in all versions beyond version 2 the header file in all probability won’t be called "ITLogLib2StdCxx.h" any more.

See also:

·      Setting up your project