CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Member Functions | Static Public Attributes | List of all members
ctkLogService Struct Referenceabstract

#include <Libs/PluginFramework/service/log/ctkLogService.h>

Public Member Functions

virtual int getLogLevel () const =0
 
virtual void log (const ctkServiceReference &sr, int level, const QString &message, const std::exception *exception=0, const char *file=0, const char *function=0, int line=-1)=0
 
virtual void log (int level, const QString &message, const std::exception *exception=0, const char *file=0, const char *function=0, int line=-1)=0
 
virtual ~ctkLogService ()
 

Static Public Attributes

static const int LOG_DEBUG
 
static const int LOG_ERROR
 
static const int LOG_INFO
 
static const int LOG_WARNING
 

Detailed Description

Provides methods for plugins to write messages to the log.

ctkLogService methods are provided to log messages; optionally with a ctkServiceReference object or an exception.

Plugins must log messages in the Plugin Framework with a severity level according to the following hierarchy:

  1. LOG_ERROR
  2. LOG_WARNING
  3. LOG_INFO
  4. LOG_DEBUG
Remarks
This class is thread safe.

Definition at line 54 of file ctkLogService.h.

Constructor & Destructor Documentation

◆ ~ctkLogService()

virtual ctkLogService::~ctkLogService ( )
inlinevirtual

Definition at line 57 of file ctkLogService.h.

Member Function Documentation

◆ getLogLevel()

virtual int ctkLogService::getLogLevel ( ) const
pure virtual

Get the current log level. The log service discards log entries with a level that is less severe than the current level. E.g. if the current log level is LOG_WARNING then the log service will discard all log entries with level LOG_INFO and LOG_DEBUG.

Returns
The lowest severity level that is accepted into the log.

◆ log() [1/2]

virtual void ctkLogService::log ( const ctkServiceReference sr,
int  level,
const QString &  message,
const std::exception *  exception = 0,
const char *  file = 0,
const char *  function = 0,
int  line = -1 
)
pure virtual

Logs a message associated with a specific ctkServiceReference object.

The Exception field of the ctkLogEntry will be set to null.

Parameters
srThe ctkServiceReference object of the service that this message is associated with.
levelThe severity of the message. This should be one of the defined log levels but may be any integer that is interpreted in a user defined way.
messageHuman readable string describing the condition.
exceptionThe exception that reflects the condition or null.
fileThe current file name.
functionThe current function name.
lineThe current line number.
See also
LOG_ERROR
LOG_WARNING
LOG_INFO
LOG_DEBUG

◆ log() [2/2]

virtual void ctkLogService::log ( int  level,
const QString &  message,
const std::exception *  exception = 0,
const char *  file = 0,
const char *  function = 0,
int  line = -1 
)
pure virtual

Logs a message.

The ctkServiceReference field and the Exception field of the ctkLogEntry object will be set to null.

Parameters
levelThe severity of the message. This should be one of the defined log levels but may be any integer that is interpreted in a user defined way.
messageHuman readable string describing the condition.
exceptionThe exception that reflects the condition or null.
fileThe current file name.
functionThe current function name.
lineThe current line number.
See also
LOG_ERROR
LOG_WARNING
LOG_INFO
LOG_DEBUG

Member Data Documentation

◆ LOG_DEBUG

const int ctkLogService::LOG_DEBUG
static

A debugging message (Value 4).

This log entry is used for problem determination and may be irrelevant to anyone but the plugin developer.

Definition at line 93 of file ctkLogService.h.

◆ LOG_ERROR

const int ctkLogService::LOG_ERROR
static

An error message (Value 1).

This log entry indicates the plugin or service may not be functional.

Definition at line 66 of file ctkLogService.h.

◆ LOG_INFO

const int ctkLogService::LOG_INFO
static

An informational message (Value 3).

This log entry may be the result of any change in the plugin or service and does not indicate a problem.

Definition at line 84 of file ctkLogService.h.

◆ LOG_WARNING

const int ctkLogService::LOG_WARNING
static

A warning message (Value 2).

This log entry indicates a plugin or service is still functioning but may experience problems in the future because of the warning condition.

Definition at line 75 of file ctkLogService.h.


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