Base (abstract) class of a generic log-output renderer. More...
#include <H:/WOSH/win32_vc2010/src/core/LogHandlers.h>
Public Member Functions | |
| LogHandler () | |
| Default constructor. Assign ID and register instance to global list (reentrant). | |
| virtual | ~LogHandler () |
| Destructor. Unregister instance from global list (reentrant) | |
| virtual void | log (const char *context, LogLevel level, const char *format, va_list args)=0 |
| Log a generic message (using same format as printf). Reentrant. | |
| virtual WRESULT | open ()=0 |
| Open the output (device) for writing. Reentrant. | |
| virtual WRESULT | close ()=0 |
| Close the output (device). Reentrant. | |
| virtual WRESULT | flush ()=0 |
| Force writing the buffer to the output (device). Reentrant. | |
| virtual bool | isOpen () const =0 |
| Evaluate if the output (device) is open for writing. Reentrant. | |
| virtual WRESULT | setProtocol (const std::string &protocol_string)=0 |
| Set the current protocol string: a standard way to reconfigure handler. | |
| virtual std::string | getProtocol () const =0 |
| Get the current protocol string. | |
Getters | |
| long | getID () const |
| Get ID of the handler. | |
| int | getLogLevelMask () const |
Protected Member Functions | |
| void | bufferTime (const char *format) |
| Render current (local) timestamp to internal buffer. | |
Static Protected Member Functions | |
| static tLogHandlerList & | getInstances () |
| Get instances of LogHandler implementations. Meyer singleton. | |
Protected Attributes | |
| long | id |
| unique id of the handler (random positive long) | |
| MutexRW | configMux |
| mutex of previous vars | |
| char | bufferDateTime [32] |
| buffer of the timestamp | |
| int | maskLevel |
| buffer of the timestamp | |
| Mutex | writeMux |
| mutex of the write operation | |
Private Attributes | |
| bool | skip_unregister_instance |
| when true it won't unregister instance on destructor, used *only* by SystemLogger | |
Friends | |
| class | wosh::SystemLogger |
Base (abstract) class of a generic log-output renderer.
Implementations must be (fully) thread safe (reentrant).
Log entries are usually formatted as: LEVEL TIMESTAMP CONTEXT(+indentation) CONTENT
Definition at line 66 of file LogHandlers.h.
| wosh::LogHandler::LogHandler | ( | ) |
Default constructor. Assign ID and register instance to global list (reentrant).
Definition at line 83 of file LogHandlers.cpp.
References wosh::LOG_ALL.
| wosh::LogHandler::~LogHandler | ( | ) | [virtual] |
Destructor. Unregister instance from global list (reentrant)
Definition at line 90 of file LogHandlers.cpp.
| void wosh::LogHandler::bufferTime | ( | const char * | format ) | [protected] |
Render current (local) timestamp to internal buffer.
| format | [in] format of the output |
Definition at line 96 of file LogHandlers.cpp.
| virtual WRESULT wosh::LogHandler::close | ( | ) | [pure virtual] |
Close the output (device). Reentrant.
Implemented in wosh::LogHandlerPlainText, wosh::LogHandlerStdOut, wosh::LogHandlerMultiplexer< COUNT >, wosh::gui::LogHandlerQRenderer, and wosh::LogHandlerMultiplexer< 4 >.
Referenced by wosh::LogHandlerMultiplexer< 4 >::close().
| virtual WRESULT wosh::LogHandler::flush | ( | ) | [pure virtual] |
Force writing the buffer to the output (device). Reentrant.
Implemented in wosh::LogHandlerPlainText, wosh::LogHandlerStdOut, wosh::LogHandlerMultiplexer< COUNT >, wosh::gui::LogHandlerQRenderer, and wosh::LogHandlerMultiplexer< 4 >.
Referenced by wosh::LogHandlerMultiplexer< 4 >::flush().
| long wosh::LogHandler::getID | ( | ) | const [inline] |
Get ID of the handler.
Definition at line 153 of file LogHandlers.h.
References id.
Referenced by wosh::LogHandlerMultiplexer< 4 >::getProtocol().
| LogHandler::tLogHandlerList & wosh::LogHandler::getInstances | ( | ) | [static, protected] |
Get instances of LogHandler implementations. Meyer singleton.
Definition at line 75 of file LogHandlers.cpp.
| virtual std::string wosh::LogHandler::getProtocol | ( | ) | const [pure virtual] |
Get the current protocol string.
Implemented in wosh::LogHandlerPlainText, wosh::LogHandlerStdOut, wosh::LogHandlerMultiplexer< COUNT >, wosh::gui::LogHandlerQRenderer, and wosh::LogHandlerMultiplexer< 4 >.
| virtual bool wosh::LogHandler::isOpen | ( | ) | const [pure virtual] |
Evaluate if the output (device) is open for writing. Reentrant.
Implemented in wosh::LogHandlerPlainText, wosh::LogHandlerStdOut, wosh::LogHandlerMultiplexer< COUNT >, wosh::gui::LogHandlerQRenderer, and wosh::LogHandlerMultiplexer< 4 >.
| virtual void wosh::LogHandler::log | ( | const char * | context, |
| LogLevel | level, | ||
| const char * | format, | ||
| va_list | args | ||
| ) | [pure 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 |
Implemented in wosh::LogHandlerPlainText, wosh::LogHandlerStdOut, wosh::LogHandlerMultiplexer< COUNT >, wosh::gui::LogHandlerQRenderer, and wosh::LogHandlerMultiplexer< 4 >.
Referenced by wosh::LogHandlerMultiplexer< 4 >::log().
| virtual WRESULT wosh::LogHandler::open | ( | ) | [pure virtual] |
Open the output (device) for writing. Reentrant.
Implemented in wosh::LogHandlerPlainText, wosh::LogHandlerStdOut, wosh::LogHandlerMultiplexer< COUNT >, wosh::gui::LogHandlerQRenderer, and wosh::LogHandlerMultiplexer< 4 >.
Referenced by wosh::LogHandlerMultiplexer< 4 >::open().
| virtual WRESULT wosh::LogHandler::setProtocol | ( | const std::string & | protocol_string ) | [pure virtual] |
Set the current protocol string: a standard way to reconfigure handler.
| protocol_string | [in] literal string representing log-handler type and its settings, separator is '://' |
Implemented in wosh::LogHandlerPlainText, wosh::LogHandlerStdOut, wosh::LogHandlerMultiplexer< COUNT >, wosh::gui::LogHandlerQRenderer, and wosh::LogHandlerMultiplexer< 4 >.
char wosh::LogHandler::bufferDateTime[32] [protected] |
buffer of the timestamp
Definition at line 170 of file LogHandlers.h.
MutexRW wosh::LogHandler::configMux [protected] |
mutex of previous vars
Definition at line 169 of file LogHandlers.h.
Referenced by wosh::LogHandlerMultiplexer< 4 >::close(), wosh::LogHandlerMultiplexer< 4 >::flush(), wosh::LogHandlerPlainText::getFileName(), wosh::LogHandlerMultiplexer< 4 >::getProtocol(), wosh::gui::LogHandlerQRenderer::getProtocol(), wosh::LogHandlerStdOut::isColoured(), wosh::LogHandlerMultiplexer< 4 >::isOpen(), wosh::LogHandlerMultiplexer< 4 >::log(), and wosh::LogHandlerMultiplexer< 4 >::open().
long wosh::LogHandler::id [protected] |
unique id of the handler (random positive long)
Definition at line 168 of file LogHandlers.h.
Referenced by getID().
int wosh::LogHandler::maskLevel [protected] |
buffer of the timestamp
Definition at line 171 of file LogHandlers.h.
bool wosh::LogHandler::skip_unregister_instance [private] |
when true it won't unregister instance on destructor, used *only* by SystemLogger
Definition at line 181 of file LogHandlers.h.
Mutex wosh::LogHandler::writeMux [protected] |
mutex of the write operation
Definition at line 172 of file LogHandlers.h.
Referenced by wosh::LogHandlerMultiplexer< 4 >::log().