QtWebApp
|
Represents a single log message together with some data that are used to decorate the log message. More...
#include <logmessage.h>
Public Member Functions | |
LogMessage (const QtMsgType type, const QString &message, const QHash< QString, QString > *logVars, const QString &file, const QString &function, const int line) | |
Constructor. More... | |
QString | toString (const QString &msgFormat, const QString ×tampFormat) const |
Returns the log message as decorated string. More... | |
QtMsgType | getType () const |
Get the message type. | |
Represents a single log message together with some data that are used to decorate the log message.
The following variables may be used in the message and in msgFormat:
Plus some new variables since QT 5.0, only filled when compiled in debug mode:
Definition at line 36 of file logmessage.h.
LogMessage::LogMessage | ( | const QtMsgType | type, |
const QString & | message, | ||
const QHash< QString, QString > * | logVars, | ||
const QString & | file, | ||
const QString & | function, | ||
const int | line | ||
) |
Constructor.
All parameters are copied, so that later changes to them do not affect this object.
type | Type of the message |
message | Message text |
logVars | Logger variables, 0 is allowed |
file | Name of the source file where the message was generated |
function | Name of the function where the message was generated |
line | Line Number of the source file, where the message was generated |
Definition at line 11 of file logmessage.cpp.
QString LogMessage::toString | ( | const QString & | msgFormat, |
const QString & | timestampFormat | ||
) | const |
Returns the log message as decorated string.
msgFormat | Format of the decoration. May contain variables and static text, e.g. "{timestamp} {type} thread={thread}: {msg}". |
timestampFormat | Format of timestamp, e.g. "dd.MM.yyyy hh:mm:ss.zzz", see QDateTime::toString(). |
Definition at line 29 of file logmessage.cpp.