#include <molequeue/logentry.h>
Public Types | |
enum | LogEntryType { DebugMessage = 0, Notification, Warning, Error } |
Public Member Functions | |
LogEntry (LogEntryType type, const QString &message_, const IdType &moleQueueId_=InvalidId) | |
LogEntry (const LogEntry &other) | |
virtual | ~LogEntry () |
LogEntryType | entryType () const |
bool | isEntryType (LogEntryType type) const |
void | setMessage (const QString &message_) |
QString | message () const |
void | setMoleQueueId (IdType moleQueueId_) |
IdType | moleQueueId () const |
const QDateTime & | timeStamp () const |
Protected Member Functions | |
LogEntry (const QJsonObject &json) | |
void | writeSettings (QJsonObject &root) const |
void | setTimeStamp () |
Message and metadata for log messages.
Each LogEntry object represents an entry in the MoleQueue log. LogEntries fall into one of four categories:
The easiest way to add new entries to the log is to use the static functions in Logger:
Each LogEntry contains a user-friendly message, an LogEntryType to identify the type of log entry, an optional MoleQueue id for any associate Job, and a timestamp, which is set by the Logger when the entry is added.
enum LogEntryType |
Enumeration of different types of log entries.
Enumerator | |
---|---|
DebugMessage |
Verbose debugging information. |
Notification |
Routine information that is relevant to the user. |
Warning |
Non-routine information that is relevant to the user, but does not indicate a serious problem. |
Error |
Serious problem that will affect either the MoleQueue application or a Job's ability to perform properly. |
LogEntry | ( | LogEntryType | type, |
const QString & | message_, | ||
const IdType & | moleQueueId_ = InvalidId |
||
) |
LogEntry Construct a new log entry.
type | Type of log message. |
message_ | Descriptive user-visible message for log. |
moleQueueId_ | MoleQueue id of any associated job. |
|
virtual |
Destroy the log entry.
|
protected |
Initialize from data in the QJsonObject.
LogEntryType entryType | ( | ) | const |
bool isEntryType | ( | LogEntryType | type | ) | const |
void setMessage | ( | const QString & | message_ | ) |
A user-friendly log message.
QString message | ( | ) | const |
A user-friendly log message.
void setMoleQueueId | ( | IdType | moleQueueId_ | ) |
The MoleQueue id of the associated job (if any, InvalidId otherwise).
IdType moleQueueId | ( | ) | const |
The MoleQueue id of the associated job (if any, InvalidId otherwise).
|
protected |
Write this entry's settings to the QJsonObject.
|
protected |
Set the timestamp on this LogEntry to the current time.