Thread safe implementation of streamlog
Created by: rete
BEGINRELEASENOTES
- Re-implemented streamlog library with new features and thread safety
- Thread safety:
- Each logger can be thread safe depending on creation parameter (enable/disable thread safety)
- Global logger thread safety fixed at library compilation time using the cmake option
-DSTREAMLOG_DEFAULT_LOGGER_TS=ON/OFF
(default is OFF) - If you want coherent messages while using std::cout, you need to activate the cmake option
-DSTREAMLOG_COUT_TS=ON
, Default is OFF
- If thread safety parameter is used:
- Logging from two threads in the same logger is thread safe
- Changing any logger property (log level, name, formatter, ...) while logging in another thread is thread safe
- New features:
- Possibility to format differently the log message output using the
standard_formatter
class (time, thread id, logger name and level) - Possibility to sub class the
formatter
class to provide custom formatting - Possibility to log in different output streams (console, file, etc...) using the same logger by using
sinks
- Builtin sinks:
- console (std::cout)
- colored console (std::cout)
- simple file (std::ofstream)
- multi thread files: one log file per logging thread
- Possibility to format differently the log message output using the
- Added Readme.md file describing the new API and features
- Redesigned such that any program using
streamlog_out(LEVEL)
pre-processor like macros is backward compatible - Breaks backward compatibility regarding streamlog initialization. Example: initialization in Marlin framework
- Added simple example and multi threading example
ENDRELEASENOTES