OpenWalnut
1.5.0dev
|
Represents a simple log message with some attributes. More...
#include <WLogEntry.h>
Public Member Functions | |
WLogEntry (std::string logTime, std::string message, LogLevel level, std::string source="") | |
Creates a new log message. More... | |
virtual | ~WLogEntry () |
Destroys a log message entry. More... | |
std::string | getLogString (std::string format="[%t] *%l* %m \n", bool colors=true) const |
LogLevel | getLogLevel () const |
std::string | getMessage () const |
Returns the plain message of the entry. More... | |
std::string | getSource () const |
Returns the sender of the log. More... | |
std::string | getTime () const |
Returns the formatted time string. More... | |
Private Attributes | |
std::string | m_time |
The time the log message was received. More... | |
std::string | m_message |
The actual message. More... | |
LogLevel | m_level |
Log level. More... | |
std::string | m_source |
Source (e.g. More... | |
WTerminalColor | m_errorColor |
Color used for error logs. More... | |
WTerminalColor | m_infoColor |
Color used for info logs. More... | |
WTerminalColor | m_debugColor |
Color used for debug logs. More... | |
WTerminalColor | m_warningColor |
Color used for warning logs. More... | |
WTerminalColor | m_sourceColor |
Color used for source field. More... | |
WTerminalColor | m_timeColor |
Color used for time. More... | |
WTerminalColor | m_messageColor |
Color used for the message. More... | |
Represents a simple log message with some attributes.
Definition at line 56 of file WLogEntry.h.
WLogEntry::WLogEntry | ( | std::string | logTime, |
std::string | message, | ||
LogLevel | level, | ||
std::string | source = "" |
||
) |
Creates a new log message.
logTime | the time |
message | the message |
level | the log level |
source | the source, sending the log |
Definition at line 58 of file WLogEntry.cpp.
|
virtual |
Destroys a log message entry.
Definition at line 73 of file WLogEntry.cpp.
LogLevel WLogEntry::getLogLevel | ( | ) | const |
Definition at line 116 of file WLogEntry.cpp.
References m_level.
Referenced by WQtMessageDock::addLogMessage(), WMainWindow::event(), WLogStream::printEntry(), and WQtGui::slotAddLog().
std::string WLogEntry::getLogString | ( | std::string | format = "[%t] *%l* %m \n" , |
bool | colors = true |
||
) | const |
format | A string describing the output format in c printf style |
colors | True if colors should be used. True is the default. |
Definition at line 77 of file WLogEntry.cpp.
References m_debugColor, m_errorColor, m_infoColor, m_level, m_message, m_messageColor, m_source, m_sourceColor, m_time, m_timeColor, m_warningColor, and WTerminalColor::setEnabled().
Referenced by WLogStream::printEntry(), WLogEntryTest::testEmptyStringAsFormatString(), WLogEntryTest::testFormatStringReplacement(), and WLogEntryTest::testUnkownLogLevel().
std::string WLogEntry::getMessage | ( | ) | const |
Returns the plain message of the entry.
Definition at line 121 of file WLogEntry.cpp.
References m_message.
Referenced by WQtMessageDock::addLogMessage(), and WMainWindow::event().
std::string WLogEntry::getSource | ( | ) | const |
Returns the sender of the log.
Definition at line 126 of file WLogEntry.cpp.
References m_source.
Referenced by WQtMessageDock::addLogMessage(), and WMainWindow::event().
std::string WLogEntry::getTime | ( | ) | const |
Returns the formatted time string.
Definition at line 131 of file WLogEntry.cpp.
References m_time.
|
mutableprivate |
Color used for debug logs.
Definition at line 149 of file WLogEntry.h.
Referenced by getLogString().
|
mutableprivate |
Color used for error logs.
Definition at line 135 of file WLogEntry.h.
Referenced by getLogString().
|
mutableprivate |
Color used for info logs.
Definition at line 142 of file WLogEntry.h.
Referenced by getLogString().
|
private |
Log level.
Definition at line 123 of file WLogEntry.h.
Referenced by getLogLevel(), and getLogString().
|
private |
The actual message.
Definition at line 118 of file WLogEntry.h.
Referenced by getLogString(), and getMessage().
|
mutableprivate |
Color used for the message.
Definition at line 177 of file WLogEntry.h.
Referenced by getLogString().
|
private |
Source (e.g.
module name) where this log message comes from.
Definition at line 128 of file WLogEntry.h.
Referenced by getLogString(), and getSource().
|
mutableprivate |
Color used for source field.
Definition at line 163 of file WLogEntry.h.
Referenced by getLogString().
|
private |
The time the log message was received.
Definition at line 113 of file WLogEntry.h.
Referenced by getLogString(), and getTime().
|
mutableprivate |
Color used for time.
Definition at line 170 of file WLogEntry.h.
Referenced by getLogString().
|
mutableprivate |
Color used for warning logs.
Definition at line 156 of file WLogEntry.h.
Referenced by getLogString().