Matrix Science header
Public Types | Public Member Functions | Static Public Member Functions

ms_loggingmonitor Class Reference
[Shared classes for handling errors and warnings in Mascot Parser modules]

Monitor class to delegate logging events generated from multiple sources. More...

#include <ms_logging.hpp>

Collaboration diagram for ms_loggingmonitor:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Level_e {
  LVL_ERROR = 1,
  LVL_WARNING = 2,
  LVL_INFO = 4,
  LVL_DEBUG1 = 8,
  LVL_DEBUG2 = 16,
  LVL_DEBUG3 = 32
}
 

Logging severity levels.

More...
enum  Source_e {
  SRC_APPLICATION = 1,
  SRC_MASCOTSERVER = 2,
  SRC_MSPARSER = 3,
  SRC_MDRO = 4,
  SRC_MSQUANTLIB = 5,
  SRC_PURIFIERAPI = 6,
  SRC_PURIFIERAPP = 7,
  SRC_DENOVOLIB = 8,
  SRC_VENDORSTART = 100
}
 

Logging event source.

More...

Public Member Functions

 ms_loggingmonitor ()
 Constructor.
virtual ~ms_loggingmonitor ()
 Destructor.
virtual int addLogEventsHandler (ms_logger &logger)
 Registers the passed ms_logger with the ms_loggingmonitor.
virtual ms_loggergetLogEventsHandler (const int uid)
 Returns the ms_logger object associated with the passed uid, or null if the specified uid is invalid.
virtual long getLogMask ()
 Returns the current logging events mask.
virtual void logMessage (Level_e eSeverity, Source_e eSource, long lMsgId, const std::string &text, long lContextId=0) const
 Logs the passed message with all registered ms_logger objects.
virtual bool removeLogEventsHandler (const int uid)
 Deregisters the specified ms_logger from the ms_loggingmonitor.
virtual void setLogMask (long newVal)
 Sets the current logging events mask.

Static Public Member Functions

static
matrix_science::ms_loggingmonitor
getDefaultMonitor ()
 Returns the global ms_loggingmonitor used by msparser.
static std::string messageSourceAsText (Source_e eSource)
 Returns a Source_e enum value as a text string.
static void setDefaultMonitor (ms_loggingmonitor &loggingMonitor)
 Sets the global ms_loggingmonitor to be used by msparser.
static std::string severityAsText (Level_e eSeverity)
 Returns a severity enum value as a text string.

Detailed Description

Monitor class to delegate logging events generated from multiple sources.


Member Enumeration Documentation

enum Level_e

Logging severity levels.

These have the same meaning as ms_errs::msg_sev, but do not have the same values. See Using enumerated values in Perl, Java, Python and C#.

Enumerator:
LVL_ERROR 

A fatal error that results in the object being 'invalid'.

LVL_WARNING 

A warning message.

LVL_INFO 

Information message. Not available by default unless setLoggingMask() called.

LVL_DEBUG1 

Debug level 1 message. Not available by default unless setLoggingMask() called .

LVL_DEBUG2 

Debug level 2 message. Not available by default unless setLoggingMask() called.

LVL_DEBUG3 

Debug level 3 message. Not available by default unless setLoggingMask() called.

enum Source_e

Logging event source.

See Using enumerated values in Perl, Java, Python and C#.

Enumerator:
SRC_APPLICATION 

Logging event raised by the current application.

SRC_MASCOTSERVER 

Logging event raised by Mascot server.

SRC_MSPARSER 

Logging event raised by the msparser library.

SRC_MDRO 

Logging event raised by the MDRO library.

SRC_MSQUANTLIB 

Logging event raised by the msquantlib library.

SRC_PURIFIERAPI 

Logging event raised by the purifierapi library.

SRC_PURIFIERAPP 

Logging event raised by the Purifier application.

SRC_DENOVOLIB 

Logging event raised by the Denovo library.

SRC_VENDORSTART 

Use this value for third party applications.


Member Function Documentation

int addLogEventsHandler ( ms_logger logger ) [virtual]

Registers the passed ms_logger with the ms_loggingmonitor.

Parameters:
loggeris the ms_logger object to add
Returns:
the uid of the logger object in the ms_loggingmonitor, or -1 if it is already registered
matrix_science::ms_loggingmonitor & getDefaultMonitor (  ) [static]

Returns the global ms_loggingmonitor used by msparser.

To add a custom ms_logger to the default ms_logging monitor, call getDefaultMonitor().addLogEventsHandler()

Returns:
the global ms_loggingmonitor object used to handle all logging events from msparser
ms_logger * getLogEventsHandler ( const int  uid ) [virtual]

Returns the ms_logger object associated with the passed uid, or null if the specified uid is invalid.

Parameters:
uidthe uid of the ms_logger to retrieve
Returns:
the ms_logger associated with the passed uid or NULL if not found
long getLogMask (  ) [virtual]

Returns the current logging events mask.

The default log mask value is Level_e::LVL_ERROR | Level_e::LVL_WARNING, so only messages with a severity level of Level_e::LVL_ERROR or Level_e::LVL_WARNING will be logged

Returns:
the current logging events mask.
std::string messageSourceAsText ( Source_e  eSource ) [static]

Returns a Source_e enum value as a text string.

Useful for writing a human readable log file, this method returns the message source as text:

  • SRC_APPLICATION : "APPLICATION_"
  • SRC_MASCOTSERVER : "MASCOTSERVER"
  • SRC_MSPARSER : "MSPARSER_API"
  • SRC_MDRO : "MDRO_LIB_API"
  • SRC_MSQUANTLIB : "QUANTLIB_API"
  • SRC_PURIFIERAPI : "PURIFIER_API"
  • SRC_PURIFIERAPP : "PURIFIER_APP"
  • SRC_DENOVOLIB : "MSDENOVO_API"
  • SRC_VENDORSTART : "VENDOR_START"
  • Any other number : "UNKNOWN_SRC_"
Parameters:
eSourceshould be on of the ms_loggingmonitor::Source_e enum values
Returns:
One of 12 character strings above.
bool removeLogEventsHandler ( const int  uid ) [virtual]

Deregisters the specified ms_logger from the ms_loggingmonitor.

Parameters:
uidthe uid of the ms_logger to removed
Returns:
true if the specified ms_logger was removed, false if it was not found
void setDefaultMonitor ( ms_loggingmonitor loggingMonitor ) [static]

Sets the global ms_loggingmonitor to be used by msparser.

It is normally sufficient to add ms_logger objects to the default ms_loggingmonitor using getDefaultMonitor()

Parameters:
loggingMonitorthe ms_loggingmonitor to use
void setLogMask ( long  newVal ) [virtual]

Sets the current logging events mask.

Parameters:
newValthe new log mask value to set. Bitwise Or the relevant ms_loggingmonitor::Level_e values
std::string severityAsText ( Level_e  eSeverity ) [static]

Returns a severity enum value as a text string.

Useful for writing a human readable log file, this method returns the message severity as text:

  • LVL_ERROR : "LVL_ERROR "
  • LVL_WARNING : "LVL_WARNING"
  • LVL_INFO : "LVL_INFO "
  • LVL_DEBUG1 : "LVL_DEBUG1 "
  • LVL_DEBUG2 : "LVL_DEBUG2 "
  • LVL_DEBUG3 : "LVL_DEBUG3 "
  • Unrecognised : "LVL_UNKNOWN"
Parameters:
eSeverityshould be on of the ms_loggingmonitor::Level_e enum values
Returns:
One of 11 character strings above.

The documentation for this class was generated from the following files:
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:52