MoleQueue  0.8.0
Public Slots | Signals | Static Public Member Functions | Protected Slots | List of all members
Logger Class Reference

#include <molequeue/logger.h>

Inheritance diagram for Logger:

Public Slots

static void logEntry (MoleQueue::LogEntry &entry)
 
static void logEntry (LogEntry::LogEntryType type, const QString &message, const IdType &moleQueueId=InvalidId)
 
static void logDebugMessage (const QString &message, const IdType &moleQueueId=InvalidId)
 
static void logNotification (const QString &message, const IdType &moleQueueId=InvalidId)
 
static void logWarning (const QString &message, const IdType &moleQueueId=InvalidId)
 
static void logError (const QString &message, const IdType &moleQueueId=InvalidId)
 
static void setPrintDebugMessages (bool print)
 
static void setPrintNotifications (bool print)
 
static void setPrintWarnings (bool print)
 
static void setPrintErrors (bool print)
 
static QLinkedList< LogEntrylog ()
 
static void setMaxEntries (int max)
 
static void clear ()
 
static void resetNewErrorCount ()
 
static void silenceNewErrors (bool silence=true)
 

Signals

void newDebugMessage (const MoleQueue::LogEntry &debug)
 
void newNotification (const MoleQueue::LogEntry &notif)
 
void newWarning (const MoleQueue::LogEntry &warning)
 
void newError (const MoleQueue::LogEntry &error)
 
void newLogEntry (const MoleQueue::LogEntry &entry)
 
void firstNewErrorOccurred ()
 
void newErrorCountReset ()
 

Static Public Member Functions

static LoggergetInstance ()
 
static bool printDebugMessages ()
 
static bool printNotifications ()
 
static bool printWarnings ()
 
static bool printErrors ()
 
static int maxEntries ()
 
static int numNewErrors ()
 

Protected Slots

void cleanUp ()
 

Detailed Description

Manage log messages.

Author
David C. Lonie

The singleton Logger class is used to handle log messages in MoleQueue. Log messages are represented as objects consisting of a user-friendly string, an enum value representing a subtype, and an optional MoleQueue id for any associated job.

There are four levels of log messages:

New log entries can be submitted using the static Logger::logEntry method or the convenient logDebugMessage, logNotification, logWarning, or logError. Each new log entry causes the newLogEntry signal to be emitted, as well as one of newDebugMessage, newNotification, newWarning, or newError, depending on the LogEntry type. Details of new log entries will be automatically sent to qDebug() if the print* methods are set to true (false by default).

Member Function Documentation

◆ getInstance()

static Logger* getInstance ( )
static
Returns
The singleton Logger instance

◆ printDebugMessages()

static bool printDebugMessages ( )
static
Returns
Whether or not to print debugging messages to qDebug. Default: false

◆ printNotifications()

static bool printNotifications ( )
static
Returns
Whether or not to print notifications to qDebug. Default: false

◆ printWarnings()

static bool printWarnings ( )
static
Returns
Whether or not to print warnings to qDebug. Default: false

◆ printErrors()

static bool printErrors ( )
static
Returns
Whether or not to print errors to qDebug. Default: false

◆ maxEntries()

static int maxEntries ( )
static
Returns
The maximum number of entries the Logger will track. Default: 1000

◆ numNewErrors()

static int numNewErrors ( )
static
Returns
The number of new errors that have occurred since the last Logger::resetNewErrors call.

◆ newDebugMessage

void newDebugMessage ( const MoleQueue::LogEntry debug)
signal

Emitted when a new debugging message has been added to the log.

◆ newNotification

void newNotification ( const MoleQueue::LogEntry notif)
signal

Emitted when a new notification has been added to the log.

◆ newWarning

void newWarning ( const MoleQueue::LogEntry warning)
signal

Emitted when a new warning has been added to the log.

◆ newError

void newError ( const MoleQueue::LogEntry error)
signal

Emitted when a new error has been added to the log.

◆ newLogEntry

void newLogEntry ( const MoleQueue::LogEntry entry)
signal

Emitted when any new log entry is added to the log.

◆ firstNewErrorOccurred

void firstNewErrorOccurred ( )
signal

Emitted when the new error count becomes non-zero. Monitor this to check for the presence of errors without getting notified about each error.

◆ newErrorCountReset

void newErrorCountReset ( )
signal

Emitted when the new error count is reset.

◆ logEntry [1/2]

static void logEntry ( MoleQueue::LogEntry entry)
staticslot

Add entry to the log.

◆ logEntry [2/2]

static void logEntry ( LogEntry::LogEntryType  type,
const QString &  message,
const IdType &  moleQueueId = InvalidId 
)
staticslot

Add a new log entry to the log.

◆ logDebugMessage

static void logDebugMessage ( const QString &  message,
const IdType &  moleQueueId = InvalidId 
)
staticslot

Add a new debugging message to the log.

◆ logNotification

static void logNotification ( const QString &  message,
const IdType &  moleQueueId = InvalidId 
)
staticslot

Add a new notification to the log.

◆ logWarning

static void logWarning ( const QString &  message,
const IdType &  moleQueueId = InvalidId 
)
staticslot

Add a new warning to the log.

◆ logError

static void logError ( const QString &  message,
const IdType &  moleQueueId = InvalidId 
)
staticslot

Add a new error to the log.

◆ setPrintDebugMessages

static void setPrintDebugMessages ( bool  print)
staticslot
Parameters
printWhether or not to print debugging messages to qDebug. Default: false

◆ setPrintNotifications

static void setPrintNotifications ( bool  print)
staticslot
Parameters
printWhether or not to print notifications to qDebug. Default: false

◆ setPrintWarnings

static void setPrintWarnings ( bool  print)
staticslot
Parameters
printWhether or not to print warnings to qDebug. Default: false

◆ setPrintErrors

static void setPrintErrors ( bool  print)
staticslot
Parameters
printWhether or not to print errors to qDebug. Default: false

◆ log

static QLinkedList<LogEntry> log ( )
staticslot
Returns
A list of all log entries.

◆ setMaxEntries

static void setMaxEntries ( int  max)
staticslot
Parameters
maxThe maximum number of entries the Logger will track. Default: 1000

◆ clear

static void clear ( )
staticslot

Remove all entries from the log.

◆ resetNewErrorCount

static void resetNewErrorCount ( )
staticslot

Reset the number of new errors.

◆ silenceNewErrors

static void silenceNewErrors ( bool  silence = true)
staticslot
Parameters
silenceIf true, the firstNewErrorOccurred signal will not be emitted until this function is called again with false.

The documentation for this class was generated from the following file: