Render log entries to plain text file (written on local host). More...
#include <H:/WOSH/win32_vc2010/src/core/LogHandlers.h>
Public Member Functions | |
| LogHandlerPlainText () | |
| Default constructor. Initialize vars. | |
| virtual | ~LogHandlerPlainText () |
| Destructor. Close the output (device) when still openend. | |
| virtual void | log (const char *context, LogLevel level, const char *format, va_list args) |
| Log a generic message (using same format as printf). Reentrant. | |
| virtual WRESULT | open () |
| Open the output (device) for writing. Reentrant. | |
| virtual WRESULT | close () |
| Close the output (device). Reentrant. | |
| virtual WRESULT | flush () |
| Force writing the buffer to the output (device). Reentrant. | |
| virtual bool | isOpen () const |
| Evaluate if the output (device) is open for writing. Reentrant. | |
| virtual WRESULT | setProtocol (const std::string &protocol_string) |
| Configure the handler through protocol string. Reentrant. | |
| virtual std::string | getProtocol () const |
| Get the current protocol string. | |
Getters | |
| std::string | getFileName () const |
| Get current output filename. Reentrant. | |
Setters | |
| WRESULT | setFileName (const std::string &filename, bool append=true) |
| Set current output filename. When handler is opened it will be closed and re-opened. Reentrant. | |
Protected Attributes | |
| FILE * | outFile |
| reference of the current output FILE, may be NULL | |
| std::string | outFilename |
| current output filename | |
| bool | appendMode |
file-mode flag, refer to a/w parameters of fopen | |
Render log entries to plain text file (written on local host).
All methods of this class are reentrant.
Default output filename is default.log.
Protocol is file://FILENAME.
Definition at line 206 of file LogHandlers.h.
| wosh::LogHandlerPlainText::LogHandlerPlainText | ( | ) | [inline] |
Default constructor. Initialize vars.
Definition at line 214 of file LogHandlers.h.
| virtual wosh::LogHandlerPlainText::~LogHandlerPlainText | ( | ) | [inline, virtual] |
Destructor. Close the output (device) when still openend.
Definition at line 219 of file LogHandlers.h.
References close().
| WRESULT wosh::LogHandlerPlainText::close | ( | ) | [virtual] |
Close the output (device). Reentrant.
Implements wosh::LogHandler.
Definition at line 201 of file LogHandlers.cpp.
Referenced by ~LogHandlerPlainText().
| WRESULT wosh::LogHandlerPlainText::flush | ( | ) | [virtual] |
Force writing the buffer to the output (device). Reentrant.
Implements wosh::LogHandler.
Definition at line 206 of file LogHandlers.cpp.
References WRET_OK.
| std::string wosh::LogHandlerPlainText::getFileName | ( | ) | const [inline] |
Get current output filename. Reentrant.
Definition at line 252 of file LogHandlers.h.
References wosh::LogHandler::configMux, and outFilename.
Referenced by wosh::DefaultSharedLogHandler::getFileName().
| std::string wosh::LogHandlerPlainText::getProtocol | ( | ) | const [virtual] |
Get the current protocol string.
Implements wosh::LogHandler.
Definition at line 266 of file LogHandlers.cpp.
| bool wosh::LogHandlerPlainText::isOpen | ( | ) | const [virtual] |
Evaluate if the output (device) is open for writing. Reentrant.
Implements wosh::LogHandler.
Definition at line 260 of file LogHandlers.cpp.
| void wosh::LogHandlerPlainText::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 274 of file LogHandlers.cpp.
References wosh::_GET_LogLevelIndex().
| WRESULT wosh::LogHandlerPlainText::open | ( | ) | [virtual] |
Open the output (device) for writing. Reentrant.
Implements wosh::LogHandler.
Definition at line 196 of file LogHandlers.cpp.
| WRESULT wosh::LogHandlerPlainText::setFileName | ( | const std::string & | filename, |
| bool | append = true |
||
| ) |
Set current output filename. When handler is opened it will be closed and re-opened. Reentrant.
| filename | [in] string representing the filename |
| append | [in] when true it will open file for appending; else file will be replaced |
Definition at line 163 of file LogHandlers.cpp.
References WRET_ERR_ILLEGAL_USE, WRET_ERR_INTERNAL, and WRET_OK.
| WRESULT wosh::LogHandlerPlainText::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 file://. Example: 'file://mylog.log' |
Implements wosh::LogHandler.
Definition at line 255 of file LogHandlers.cpp.
References WRET_ERR_PARAM.
bool wosh::LogHandlerPlainText::appendMode [protected] |
file-mode flag, refer to a/w parameters of fopen
Definition at line 277 of file LogHandlers.h.
FILE* wosh::LogHandlerPlainText::outFile [protected] |
reference of the current output FILE, may be NULL
Definition at line 275 of file LogHandlers.h.
std::string wosh::LogHandlerPlainText::outFilename [protected] |