Public Types | |
| enum | Level { Debug = 0, Info, Warning, Error, Fatal, NOTUSED } |
| The various possible Log levels. More... | |
Static Public Methods | |
| const char * | levelStr (Level level) |
| Get a string description for a log level. | |
| std::string | format (const Entry &entry, const std::string ×tampFormat) |
| Get a formatted version of this log message. | |
| std::string | printf (const char *format,...) |
| Format some data using a printf-style string. | |
| void | flush () |
| LogStream & | log (Level level) |
| Singleton access to the logging stream. | |
Static Public Attributes | |
| sword::Log::Endl | endl |
This class is the central point for logging information from any program. The actual place(s) where the logs will appear depends the the various LogMedia instances registered in the LogMediaManager.
The Log features are accessed using static methods (as if it was a global instance), but are really thread-local, so using the logger is fully thread-safe.
A log "line" can be built using stream operators (as you would do with std::cout for instance), and must always end with Log::endl (otherwise your log line will be stuck or sent not when you expect to).
Example:
Log::log(Log::Info) << "My log information line x=" << x << Log::endl;
|
|
The various possible Log levels.
|
|
||||||||||||
|
Get a formatted version of this log message. This method "formats" the log message: it appends the current timestamp, the log level and the actual message into one nice log line. |
|
|
Get a string description for a log level.
|
|
|
Singleton access to the logging stream.
|
|
||||||||||||
|
Format some data using a printf-style string.
|
1.3-rc2