Source- include/debug/logger.h
- src/debug/logger.cpp
UseVarious macros are defined to ease the logging functionnality of McSoup. A reference to the root Logger singleton can be obtained through Logger::get() et can be used as a stream sink (i.e. like cout, cerr and others ostream based classes). The following accessors are implemented as macros and are shortcuts to the Logger class features :
- log(level) : Lock the log output, changes the log level to level and insert a class stamp containing a level indicator and the demangled class::function() name.
- logk(level) : Like log, but without locking (useful for a multiline output which should not be broken by another thread output).
- flog(level) : Like log, but to be used in global function only. The stamp doesn't print the class name.
- flogk(level) : Like flog, but without locking (useful for a multiline output which should not be broken by another thread output).
| | lock | w/o lock | | class | log | logk | | function | flog | flogk |
LockingIt's important to take note that the log mutex is not released automatically, one should insert either a log::rls (release lock) or a log::endl (insert a new line, flushes the log and release the lock) in order to unlock the mutex.
Level4 levels of log entry are defined (from the weaker to the most important) :
- debug
- info
- warning
- critical
The default log mask is log::NORMAL, which is an equivalent of info | warning | critical, the log::VERBOSE mask allows to track debug messages as well.
|