8. Controlling Log Level

To control the level of logs that will appear from a (group of) file(s), the macro LOG_LEVEL should be define as shown below: Note: The order of definition of macros LOG_LEVEL and LOG_MODULE_NAME is very important, it should be defined before including the header liblogger.h.
        #include <liblogger/liblogger_levels.h>
        // For this file, we choose logs of priority debug and above.
        #define LOG_LEVEL LOG_LEVEL_DEBUG
        // The module name for logs done from this file.
        #define LOG_MODULE_NAME "LogDebugTest"
        #include <liblogger/liblogger.h>

In the above example, all logs with priorit lesser than LOG_LEVEL_DEBUG (in this case LOG_LEVEL_TRACE), will not appear.

If LOG_LEVEL macro is not defined, then all logs will be included.



liblogger © 2007 - SourceForge.net Logo