AnCH logging library provides configurable loggers which write messages through writers (console, files with rotation), with a map diagnostic context.
anch::log section of the application configurationCMake target anch::log:
See installation.
Loggers are retrieved with LoggerFactory::getLogger once the configuration has been loaded. Logger names are hierarchical (org::myapp::Main ): the most specific configured logger applies (org::myapp , then org , then the default logger).
Messages are logged with level methods (trace , debug , info , warn , error , fatal ), which concatenate their arguments, or with stream injection (log/stream.hpp ):
With both APIs, messages in levels lower than ANCH_LOG_MIN_LEVEL CMake option (TRACE by default) are removed at compile time. Arguments are always evaluated, even when the level is disabled. Logging never throws.
anch::log.thread-safe : writers are protected against concurrent access (default true ).anch::log.low-priority : writers write messages in a dedicated thread (default false ).[anch::log.writer.<name>] : writer declaration:module : console or file ;pattern : message pattern: $c logger name, $p level, $m message, $t thread identifier, $d{strftime format} date, $D{anch-date format} high precision date, $C{key} MDC value ;path , max-size (with K , M , G or T unit) and max-rotate-files for file writers ;thread-safe and low-priority override the global values.[anch::log.logger] : default logger ; [anch::log.logger.<name>] : logger for a name prefix:writers : comma separated writer names ;level : trace , debug , info , warn , error or fatal .Without anch::log section, messages are written on the console.
application.ini :
Console output: