OpFlex Framework 1.7.0
opflex::logging::OFLogHandler Class Referenceabstract

Interface for a log message handler for the OpFlex framework. More...

#include <opflex/logging/OFLogHandler.h>

Inheritance diagram for opflex::logging::OFLogHandler:
opflex::logging::StdOutLogHandler

Public Types

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

Public Member Functions

 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 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 shouldEmit (const Level level) __attribute__((no_instrument_function))
 Check whether we should attempt to log at the given log level.
 

Static Public Member Functions

static void registerHandler (OFLogHandler &handler) __attribute__((no_instrument_function))
 Register a custom handler as the log handler.
 
static OFLogHandlergetHandler () __attribute__((no_instrument_function))
 Get the currently-active log handler.
 

Protected Attributes

Level logLevel_
 The log level for this logger.
 

Detailed Description

Interface for a log message handler for the OpFlex framework.

You will need to implement this interface and register your implementation if you want to log to your custom handler.

By default, the OpFlex Framework will simply log to standard out at INFO or above, but you can override this behavior by registering a customer log handler.

If you simply want to disable logging, the simplest way is as follows:

StdOutLogHandler disabledHandler(OFLogHandler::NO_LOGGING);
An OFLogHandler that simply logs to standard output.
Definition StdOutLogHandler.h:25
static void registerHandler(OFLogHandler &handler) __attribute__((no_instrument_function))
Register a custom handler as the log handler.

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