SDRAngel
4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
|
#include <logmessage.h>
Public Member Functions | |
LogMessage (const QtMsgType type, const QString &message, QHash< QString, QString > *logVars, const QString &file, const QString &function, const int line) | |
QString | toString (const QString &msgFormat, const QString ×tampFormat) const |
QtMsgType | getType () const |
Private Attributes | |
QHash< QString, QString > | logVars |
QDateTime | timestamp |
QtMsgType | type |
Qt::HANDLE | threadId |
QString | message |
QString | file |
QString | function |
int | line |
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 38 of file logmessage.h.
LogMessage::LogMessage | ( | const QtMsgType | type, |
const QString & | message, | ||
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.
References file, line, logVars, message, threadId, timestamp, and type.
QtMsgType LogMessage::getType | ( | ) | const |
Get the message type.
Definition at line 87 of file logmessage.cpp.
References type.
Referenced by qtwebapp::FileLogger::write().
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. "yyyy-MM-dd HH:mm:ss.zzz", see QDateTime::toString(). |
Definition at line 29 of file logmessage.cpp.
References file, line, logVars, message, threadId, timestamp, and type.
Referenced by qtwebapp::FileLogger::write(), and qtwebapp::Logger::write().
|
private |
Filename where the message was generated
Definition at line 87 of file logmessage.h.
Referenced by LogMessage(), and toString().
|
private |
Function name where the message was generated
Definition at line 90 of file logmessage.h.
|
private |
Line number where the message was generated
Definition at line 93 of file logmessage.h.
Referenced by LogMessage(), and toString().
|
private |
Logger variables
Definition at line 72 of file logmessage.h.
Referenced by LogMessage(), and toString().
|
private |
Message text
Definition at line 84 of file logmessage.h.
Referenced by LogMessage(), and toString().
|
private |
ID number of the thread
Definition at line 81 of file logmessage.h.
Referenced by LogMessage(), and toString().
|
private |
Date and time of creation
Definition at line 75 of file logmessage.h.
Referenced by LogMessage(), and toString().
|
private |
Type of the message
Definition at line 78 of file logmessage.h.
Referenced by getType(), LogMessage(), and toString().