MoleQueue  0.8.0
 All Classes Functions Variables Enumerations Enumerator Pages
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

static Logger* getInstance ( )
static
Returns
The singleton Logger instance
static bool printDebugMessages ( )
static
Returns
Whether or not to print debugging messages to qDebug. Default: false
static bool printNotifications ( )
static
Returns
Whether or not to print notifications to qDebug. Default: false
static bool printWarnings ( )
static
Returns
Whether or not to print warnings to qDebug. Default: false
static bool printErrors ( )
static
Returns
Whether or not to print errors to qDebug. Default: false
static int maxEntries ( )
static
Returns
The maximum number of entries the Logger will track. Default: 1000
static int numNewErrors ( )
static
Returns
The number of new errors that have occurred since the last Logger::resetNewErrors call.
void newDebugMessage ( const MoleQueue::LogEntry debug)
signal

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

void newNotification ( const MoleQueue::LogEntry notif)
signal

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

void newWarning ( const MoleQueue::LogEntry warning)
signal

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

void newError ( const MoleQueue::LogEntry error)
signal

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

void newLogEntry ( const MoleQueue::LogEntry entry)
signal

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

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.

void newErrorCountReset ( )
signal

Emitted when the new error count is reset.

static void logEntry ( MoleQueue::LogEntry entry)
staticslot

Add entry to the log.

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

Add a new log entry to the log.

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

Add a new debugging message to the log.

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

Add a new notification to the log.

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

Add a new warning to the log.

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

Add a new error to the log.

static void setPrintDebugMessages ( bool  print)
staticslot
Parameters
printWhether or not to print debugging messages to qDebug. Default: false
static void setPrintNotifications ( bool  print)
staticslot
Parameters
printWhether or not to print notifications to qDebug. Default: false
static void setPrintWarnings ( bool  print)
staticslot
Parameters
printWhether or not to print warnings to qDebug. Default: false
static void setPrintErrors ( bool  print)
staticslot
Parameters
printWhether or not to print errors to qDebug. Default: false
static QLinkedList<LogEntry> log ( )
staticslot
Returns
A list of all log entries.
static void setMaxEntries ( int  max)
staticslot
Parameters
maxThe maximum number of entries the Logger will track. Default: 1000
static void clear ( )
staticslot

Remove all entries from the log.

static void resetNewErrorCount ( )
staticslot

Reset the number of new errors.

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: