DCMTK  Version 3.6.1 20121102
OFFIS DICOM Toolkit
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | List of all members
OFLogger Class Reference

simple wrapper around the "low-level" Logger object to make it easier to switch to a different system More...

+ Inheritance diagram for OFLogger:
+ Collaboration diagram for OFLogger:

Public Types

enum  LogLevel {
  TRACE_LOG_LEVEL = dcmtk::log4cplus::TRACE_LOG_LEVEL, DEBUG_LOG_LEVEL = dcmtk::log4cplus::DEBUG_LOG_LEVEL, INFO_LOG_LEVEL = dcmtk::log4cplus::INFO_LOG_LEVEL, WARN_LOG_LEVEL = dcmtk::log4cplus::WARN_LOG_LEVEL,
  ERROR_LOG_LEVEL = dcmtk::log4cplus::ERROR_LOG_LEVEL, FATAL_LOG_LEVEL = dcmtk::log4cplus::FATAL_LOG_LEVEL, OFF_LOG_LEVEL = dcmtk::log4cplus::OFF_LOG_LEVEL
}
 these are the log levels that you can feed to isEnabledFor() More...
 

Public Member Functions

 OFLogger (const dcmtk::log4cplus::Logger &base)
 copy constructor More...
 
bool isEnabledFor (dcmtk::log4cplus::LogLevel ll) const
 check if the given log level was activated. More...
 
void forcedLog (dcmtk::log4cplus::LogLevel ll, const dcmtk::log4cplus::tstring &message, const char *file=NULL, int line=-1, const char *function=NULL) const
 this function is only used internally by OFLOG_FATAL and friends
 
LogLevel getChainedLogLevel () const
 Get the logger's log level. More...
 
void setLogLevel (dcmtk::log4cplus::LogLevel ll)
 Set the logger's log level. More...
 

Additional Inherited Members

- Private Member Functions inherited from dcmtk::log4cplus::Logger
void assertion (bool assertionVal, const tstring &msg) const
 If assertionVal parameter is false, then logs msg with FATAL_LOG_LEVEL log level. More...
 
void closeNestedAppenders () const
 Close all attached appenders implementing the AppenderAttachable interface.
 
bool isEnabledFor (LogLevel ll) const
 Check whether this logger is enabled for a given LogLevel passed as parameter. More...
 
void log (LogLevel ll, const tstring &message, const char *file=NULL, int line=-1, const char *function=NULL) const
 This generic form is intended to be used by wrappers.
 
void forcedLog (LogLevel ll, const tstring &message, const char *file=NULL, int line=-1, const char *function=NULL) const
 This method creates a new logging event and logs the event without further checks.
 
void callAppenders (const spi::InternalLoggingEvent &event) const
 Call the appenders in the hierrachy starting at this. More...
 
LogLevel getChainedLogLevel () const
 Starting from this logger, search the logger hierarchy for a "set" LogLevel and return it. More...
 
LogLevel getLogLevel () const
 Returns the assigned LogLevel, if any, for this Logger. More...
 
void setLogLevel (LogLevel ll)
 Set the LogLevel of this Logger.
 
HierarchygetHierarchy () const
 Return the the Hierarchy where this Logger instance is attached.
 
tstring getName () const
 Return the logger name.
 
bool getAdditivity () const
 Get the additivity flag for this Logger instance.
 
void setAdditivity (bool additive)
 Set the additivity flag for this Logger instance.
 
virtual void addAppender (SharedAppenderPtr newAppender)
 
virtual SharedAppenderPtrList getAllAppenders ()
 
virtual SharedAppenderPtr getAppender (const tstring &name)
 
virtual void removeAllAppenders ()
 
virtual void removeAppender (SharedAppenderPtr appender)
 
virtual void removeAppender (const tstring &name)
 
 Logger (const Logger &rhs)
 
Loggeroperator= (const Logger &rhs)
 
void swap (Logger &)
 
Logger getParent () const
 Used to retrieve the parent of this Logger in the Logger tree.
 
- Static Private Member Functions inherited from dcmtk::log4cplus::Logger
static bool exists (const tstring &name)
 Returns true if the named logger exists (in the default hierarchy). More...
 
static OFList< LoggergetCurrentLoggers ()
 
static HierarchygetDefaultHierarchy ()
 Return the default Hierarchy instance.
 
static Logger getInstance (const tstring &name)
 Retrieve a logger with name name. More...
 
static Logger getInstance (const tstring &name, spi::LoggerFactory &factory)
 Like getInstance() except that the type of logger instantiated depends on the type returned by the spi::LoggerFactory#makeNewLoggerInstance method of the factory parameter. More...
 
static Logger getRoot ()
 Return the root of the default logger hierrachy. More...
 
static void shutdown ()
 Calling this method will safely close and remove all appenders in all the loggers including root contained in the default hierachy. More...
 

Detailed Description

simple wrapper around the "low-level" Logger object to make it easier to switch to a different system

Member Enumeration Documentation

these are the log levels that you can feed to isEnabledFor()

Enumerator
TRACE_LOG_LEVEL 

trace: output more details on the internal application state, a kind of "verbose debug"

DEBUG_LOG_LEVEL 

debug: fine-grained informational events that are most useful to debug an application

INFO_LOG_LEVEL 

info: informational messages that highlight the progress of the application at coarse-grained level

WARN_LOG_LEVEL 

warn: potentially harmful situations

ERROR_LOG_LEVEL 

error: events that might still allow the application to continue running

FATAL_LOG_LEVEL 

fatal: very severe error events that will presumably lead the application to abort

OFF_LOG_LEVEL 

internal: turn off logging competely

Constructor & Destructor Documentation

OFLogger::OFLogger ( const dcmtk::log4cplus::Logger base)

copy constructor

Parameters
baseobject to be copied

Member Function Documentation

LogLevel OFLogger::getChainedLogLevel ( ) const
inline

Get the logger's log level.

One of the checks that isEnabledFor() does looks like this: if (getChainedLogLevel() < level) return false;

Returns
the log level to which this logger is set.
bool OFLogger::isEnabledFor ( dcmtk::log4cplus::LogLevel  ll) const
inline

check if the given log level was activated.

This can be used to check if a given log level is activated before spending cpu time on generating a log message. The OFLOG_* macros use this automatically, so you should never do something like: if (myLogger.isEnabledFor(INFO_LOG_LEVEL)) OFLOG_INFO("Doing it like this is pointless);

Parameters
llthe log level to check for
Returns
true if messages on this level won't be discarded

References dcmtk::log4cplus::Logger::isEnabledFor().

void OFLogger::setLogLevel ( dcmtk::log4cplus::LogLevel  ll)
inline

Set the logger's log level.

Parameters
lllog level to which this logger is set.

References dcmtk::log4cplus::Logger::setLogLevel().


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


Generated on Wed Sep 4 2013 for DCMTK Version 3.6.1 20121102 by Doxygen 1.8.4