9. Associating a module name / log level with a group of source files.

Often in a project, a group of files belong to a specific module or a particular log level is needed to be associated with a group of files, this can be easily done by including the log details in a header commonly included by these source files. For Example : Declare a http_module_log.h with the following contents :
        #include <liblogger/liblogger_levels.h>
        // For this file, we choose logs of priority info and above.
        #define LOG_LEVEL LOG_LEVEL_INFO
        // The module name for logs done from this file.
        #define LOG_MODULE_NAME "HTTP Module"
        #include <liblogger/liblogger.h>

Then include this header amoung the source files which need to have the same module name and log level.

liblogger © 2007 - SourceForge.net Logo