A modern C++ logger based on Boost::Format
Copyright © Gordon "Lee" Morgan May 2016. This project is released under the MIT License
-
Portability
Traditional logging libraries which use
printfstyle formatting strings work well when you use legacyCdata types;int,float,char, pointers, etc. This breaks down for types such asuint64_tandlong long. Other types such assize_tandoff_tcan change size between 32 and 64 bit compiles on the same platform. Logging macros should not need conditional compilation to compile cleanly between multiple platforms or targets. -
Type safety
C++types such asstd::stringandstd::chrono::time_pointcannot be used withprintfwithout conversion. User defined types almost never are useable asprintfwithout helper functions. LoggerXX can be used with any type that provides aostream >>operator or provides a helper function. -
Dependencies
LoggerXX only requires two libraries to use, Boost and Date. Date is a "header only" library and is an external submodule. Boost is a very common dependency and is effectively free for a large number of projects.
-
Streaming and Format string APIs
LoggerXX allows the mixing of both format string and streaming log apis simplifying code migration or mixing source code from multiple sources.
-
Functionality
LoggerXX is designed to easily replace simple
printfderived loggers and offer advanced functionality with low overhead -
Performance
LoggerXX is intended to be enabled in both debug and release builds with a minimal performance hit. This has a number desirable effects:
- This will eliminate a number of "unused variable" warnings that typically occur in release builds when return values are logged.
- Functions can safely be used in logging macros, classic "nop" macros will remove these calls in release builds.
- You can enable a ring buffer that collects all log messages to write into a crash log, regardless of log level.
- A drop in replacement for "C printf" style logging
- C++ type safe
- extensible types
- By module, file, class, function or line log configuration
- high performance Always On logging
- Ring buffer critical error log
- Multiple log output sinks