My favorites | Sign in
Project Home Wiki Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
LogAPI  
Logging API
Updated Jan 28, 2012 by c.huri...@gmail.com

Source

  • include/debug/logger.h
  • src/debug/logger.cpp

Use

Various 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

Locking

It'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.

Level

4 levels of log entry are defined (from the weaker to the most important) :
  1. debug
  2. info
  3. warning
  4. 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.
Powered by Google Project Hosting