Render log entries to stdout (default console output). More...
#include <H:/WOSH/win32_vc2010/src/core/LogHandlers.h>
Public Member Functions | |
| LogHandlerStdOut () | |
Default constructor. Initialize vars, set (default) output to stderr. | |
| virtual | ~LogHandlerStdOut () |
| Destructor. Close the output (device) when still openend. | |
| void | log (const char *context, LogLevel level, const char *format, va_list args) |
| Log a generic message (using same format as printf). Reentrant. | |
| WRESULT | open () |
| Open the output (device) for writing. Reentrant. | |
| WRESULT | close () |
| Close the output (device). Reentrant. | |
| WRESULT | flush () |
| Force writing the buffer to the output (device). Reentrant. | |
| bool | isOpen () const |
| Evaluate if the output (device) is open for writing. Reentrant. | |
| WRESULT | setProtocol (const std::string &protocol_string) |
| Configure the handler through protocol string. Reentrant. | |
| std::string | getProtocol () const |
| Get the current protocol string. | |
Getters | |
| bool | isColoured () const |
| Evaluate if the output is coloured. Reentrant. | |
Setters | |
| void | setColoured (bool enabled=true) |
| Enable/Disable coloured output. Reentrant. | |
Static Public Member Functions | |
| static LogHandlerStdOut * | getInstance () |
| Get the singleton instance. Meyer singleton. | |
Protected Attributes | |
| FILE * | outStd |
| reference to current output. since stdout/stderr are just FILE* | |
| bool | printColoured |
| flag, when true it will print coloured messages | |
Render log entries to stdout (default console output).
The implementation is very similar to wosh::LogHandlerPlainText, but has been customized for stdout features.
All methods of this class are reentrant.
On Windows and POSIX systems, outpur may be coloured (depends on LogLevel).
Definition at line 299 of file LogHandlers.h.
| wosh::LogHandlerStdOut::LogHandlerStdOut | ( | ) | [inline] |
Default constructor. Initialize vars, set (default) output to stderr.
Definition at line 309 of file LogHandlers.h.
| virtual wosh::LogHandlerStdOut::~LogHandlerStdOut | ( | ) | [inline, virtual] |
Destructor. Close the output (device) when still openend.
Definition at line 314 of file LogHandlers.h.
References close().
| WRESULT wosh::LogHandlerStdOut::close | ( | ) | [inline, virtual] |
Close the output (device). Reentrant.
Implements wosh::LogHandler.
Definition at line 330 of file LogHandlers.h.
References WRET_OK.
Referenced by ~LogHandlerStdOut().
| WRESULT wosh::LogHandlerStdOut::flush | ( | ) | [inline, virtual] |
Force writing the buffer to the output (device). Reentrant.
Implements wosh::LogHandler.
Definition at line 331 of file LogHandlers.h.
References WRET_OK.
| LogHandlerStdOut * wosh::LogHandlerStdOut::getInstance | ( | ) | [static] |
Get the singleton instance. Meyer singleton.
Definition at line 353 of file LogHandlers.cpp.
| std::string wosh::LogHandlerStdOut::getProtocol | ( | ) | const [virtual] |
Get the current protocol string.
Implements wosh::LogHandler.
Definition at line 379 of file LogHandlers.cpp.
| bool wosh::LogHandlerStdOut::isColoured | ( | ) | const [inline] |
Evaluate if the output is coloured. Reentrant.
Definition at line 353 of file LogHandlers.h.
References wosh::LogHandler::configMux, and printColoured.
| bool wosh::LogHandlerStdOut::isOpen | ( | ) | const [inline, virtual] |
Evaluate if the output (device) is open for writing. Reentrant.
Implements wosh::LogHandler.
Definition at line 334 of file LogHandlers.h.
| void wosh::LogHandlerStdOut::log | ( | const char * | context, |
| LogLevel | level, | ||
| const char * | format, | ||
| va_list | args | ||
| ) | [virtual] |
Log a generic message (using same format as printf). Reentrant.
| context | [in] c string representing the log-context, may be NULL |
| level | [in] LogLevel of the message |
| format | [in] c string that contains the text to be written |
| args | [in] variable-arguments parameter |
Implements wosh::LogHandler.
Definition at line 391 of file LogHandlers.cpp.
References wosh::_GET_LogLevelIndex().
| WRESULT wosh::LogHandlerStdOut::open | ( | ) | [virtual] |
Open the output (device) for writing. Reentrant.
Implements wosh::LogHandler.
Definition at line 359 of file LogHandlers.cpp.
| void wosh::LogHandlerStdOut::setColoured | ( | bool | enabled = true ) |
Enable/Disable coloured output. Reentrant.
| enabled | [in] true when messages are coloured; false else |
Definition at line 386 of file LogHandlers.cpp.
| WRESULT wosh::LogHandlerStdOut::setProtocol | ( | const std::string & | protocol_string ) | [virtual] |
Configure the handler through protocol string. Reentrant.
| protocol_string | [in] literal string representing new settings, prefix must be std://. Examples: 'std://stdout', 'std://stderr' |
Implements wosh::LogHandler.
Definition at line 370 of file LogHandlers.cpp.
References WRET_ERR_PARAM, and WRET_OK.
FILE* wosh::LogHandlerStdOut::outStd [protected] |
reference to current output. since stdout/stderr are just FILE*
Definition at line 373 of file LogHandlers.h.
bool wosh::LogHandlerStdOut::printColoured [protected] |
flag, when true it will print coloured messages
Definition at line 374 of file LogHandlers.h.
Referenced by isColoured().