Including the API in your modules

If Visual Studio is properly set up (see Setting up Visual Studio) then you only have to write

#include <ITLogLib2.h>

in your modules to include the logging API.

Note that we don’t recommend directly including "ITLogLib2.h" in large projects. Therefore, please read the following tips and recommendations.

 

Tips:

§      Using the precompiled headers feature:
If you are using the "precompiled headers" feature of Visual C++ then you should include "ITLogLib2.h" in the file "stdafx.h" of your project. 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 similiar. Then you can add the
#include statement for "ITLogLib2.h" to this header file.

 

Generally we recommend that you create a wrapper around "ITLogLib2.h", at least for projects which consist of many implementation modules (*.cpp files).

This means: Create an own header file. We recommend to call it "ITLogLibX.h". It should include "ITLogLib2.h" and should be included by your implementation modules instead of "ITLogLib2.h".

Some advantages of this strategy are:

§      "ITLogLibX.h" is the right place to add your own logging utilities, like output operators for your own types.
In this respect, "X" stands for "eXtensions".

§      "ITLogLibX.h" allows you to upgrade to a higher version of iTech Logging without changing hundreds of #include-directives -- in all versions beyond version 2 the header file in all probability won’t be called "ITLogLib2.h" any more.
In this respect, "X" stands for "any number".