OpFlex Framework 1.7.0

Define logging facility for the OpFlex framework. More...

Classes

class  opflex::logging::OFLogHandler
 Interface for a log message handler for the OpFlex framework. More...
 

Enumerations

enum  opflex::logging::OFLogHandler::Level {
  TRACE , DEBUG7 , DEBUG6 , DEBUG5 ,
  DEBUG4 , DEBUG3 , DEBUG2 , DEBUG1 ,
  DEBUG0 , INFO , WARNING , ERROR ,
  FATAL , NO_LOGGING
}
 Log levels for OpFlex framework logging.
 

Functions

 opflex::logging::OFLogHandler::OFLogHandler (Level logLevel) __attribute__((no_instrument_function))
 Allocate a log handler that will log any messages with equal or greater severity than the specified log level.
 
virtual void opflex::logging::OFLogHandler::handleMessage (const std::string &file, const int line, const std::string &function, const Level level, const std::string &message)=0
 Process a single log message.
 
virtual bool opflex::logging::OFLogHandler::shouldEmit (const Level level) __attribute__((no_instrument_function))
 Check whether we should attempt to log at the given log level.
 
static void opflex::logging::OFLogHandler::registerHandler (OFLogHandler &handler) __attribute__((no_instrument_function))
 Register a custom handler as the log handler.
 
static OFLogHandleropflex::logging::OFLogHandler::getHandler () __attribute__((no_instrument_function))
 Get the currently-active log handler.
 

Variables

Level opflex::logging::OFLogHandler::logLevel_
 The log level for this logger.
 

Detailed Description

Define logging facility for the OpFlex framework.

Function Documentation

◆ getHandler()

static OFLogHandler * opflex::logging::OFLogHandler::getHandler ( )
static

Get the currently-active log handler.

Returns the default handler if there is no active custom handler.

Returns
the currently-active log handler

References getHandler(), and OFLogHandler().

Referenced by getHandler().

◆ handleMessage()

virtual void opflex::logging::OFLogHandler::handleMessage ( const std::string & file,
const int line,
const std::string & function,
const Level level,
const std::string & message )
pure virtual

Process a single log message.

This file is called synchronously from the thread that is doing the logging and is unsynchronized.

Parameters
filethe file that performs the logging
linethe line number for the log message
functionthe name of the function that's performing the logging
levelthe log level of the log message
messagethe formatted message to log

Implemented in opflex::logging::StdOutLogHandler.

References handleMessage().

Referenced by handleMessage().

◆ OFLogHandler()

opflex::logging::OFLogHandler::OFLogHandler ( Level logLevel)

Allocate a log handler that will log any messages with equal or greater severity than the specified log level.

Parameters
logLevelthe minimum log level

References OFLogHandler().

Referenced by getHandler(), OFLogHandler(), and registerHandler().

◆ registerHandler()

static void opflex::logging::OFLogHandler::registerHandler ( OFLogHandler & handler)
static

Register a custom handler as the log handler.

You must ensure that the custom log handler is not deallocated before any framework components that might need to log to it.

Parameters
handlerthe customer handler to register

References OFLogHandler(), and registerHandler().

Referenced by registerHandler().

◆ shouldEmit()

virtual bool opflex::logging::OFLogHandler::shouldEmit ( const Level level)
virtual

Check whether we should attempt to log at the given log level.

Parameters
levelthe level of a message to log
Returns
true if the log level could be allowed

References shouldEmit().

Referenced by shouldEmit().