|
DEBUG_ONLY_MACROS
VERBOSITY_LEVEL_LOGGING
Revision_History
EzLogger is a C++ logging library that can easily be added to an implementation. It can be used with both C++ style stream operators and C style printf functions.
For windows, the default policy logs the data to a text file with the same name and path of the executable, and having a postfix _debuglog.txt.
For none windows platform, the default policy logs the data to a file named ezlogger_output.txt. For details see ezlogger_output_policy
All logging is performmed through macros. This allows the logging class to automatically receive source file name, source line number, and source function name. There are four sets of macros. Two sets have fixed value verbosity level logging, and the other two sets have variable verbosity level logging.
The macro prefix determines what set it belongs to.
1. [EZLOGGER] Logging macros that implement in both debug and release version, and use default verbosity level 2. [EZLOGGERVL] Verbosity level logging macros, which implement in both debug and release version 3. [EZDBGONLYLOGGER] Logging macros that only implement in debug version, and use default verbosity level 4. [EZDBGONLYLOGGERVL] Verbosity level logging macros, which implement ONLY in debug version
// Example code for EZLOGGER macros #include "ezlogger_headers.hpp" void ezlogger_simple_example() { int i = 123; std::string somedata = "Hello World"; //Simple usage with standard verbosity level EZLOGGERSTREAM << somedata << " " << i << std::endl; //Can use alternate stream EZLOGGERSTREAM2(std::cerr) << somedata << " next line " << i << std::endl; //Verbosity level logging example EZLOGGERVLSTREAM(axter::log_often) << somedata << " " << i << std::endl; //Complex extended data example EZLOGGERVLSTREAM(axter::levels(axter::log_often, axter::warn, __FUNCSIG__ /*or GNU PRETTY_FUNCTION*/, "Xyz Facility")) << somedata << " " << i << std::endl; }