activemq-cpp-3.4.0
|
A Handler object takes log messages from a Logger and exports them. More...
#include <src/main/decaf/util/logging/Handler.h>
Public Member Functions | |
Handler () | |
virtual | ~Handler () |
virtual void | flush ()=0 |
Flush the Handler's output, clears any buffers. | |
virtual void | publish (const LogRecord &record)=0 |
Publish the Log Record to this Handler. | |
virtual bool | isLoggable (const LogRecord &record) const |
Check if this Handler would actually log a given LogRecord. | |
virtual void | setFilter (Filter *filter) |
Sets the Filter that this Handler uses to filter Log Records. | |
virtual Filter * | getFilter () |
Gets the Filter that this Handler uses to filter Log Records. | |
virtual void | setLevel (const Level &value) |
Set the log level specifying which message levels will be logged by this Handler. | |
virtual Level | getLevel () |
Get the log level specifying which message levels will be logged by this Handler. | |
virtual void | setFormatter (Formatter *formatter) |
Sets the Formatter used by this Handler. | |
virtual Formatter * | getFormatter () |
Gets the Formatter used by this Handler. | |
virtual void | setErrorManager (ErrorManager *errorManager) |
Sets the Formatter used by this Handler. | |
virtual ErrorManager * | getErrorManager () |
Gets the ErrorManager used by this Handler. | |
Protected Member Functions | |
void | reportError (const std::string &message, decaf::lang::Exception *ex, int code) |
Protected convenience method to report an error to this Handler's ErrorManager. |
A Handler object takes log messages from a Logger and exports them.
It might for example, write them to a console or write them to a file, or send them to a network logging service, or forward them to an OS log, or whatever.
A Handler can be disabled by doing a setLevel(Level.OFF) and can be re-enabled by doing a setLevel with an appropriate level.
Handler classes typically use LogManager properties to set default values for the Handler's Filter, Formatter, and Level. See the specific documentation for each concrete Handler class.
decaf::util::logging::Handler::Handler | ( | ) |
virtual decaf::util::logging::Handler::~Handler | ( | ) | [virtual] |
virtual void decaf::util::logging::Handler::flush | ( | ) | [pure virtual] |
Flush the Handler's output, clears any buffers.
Implemented in decaf::util::logging::StreamHandler.
virtual ErrorManager* decaf::util::logging::Handler::getErrorManager | ( | ) | [inline, virtual] |
Gets the ErrorManager
used by this Handler.
ErrorManager
derived pointer or NULL. virtual Filter* decaf::util::logging::Handler::getFilter | ( | ) | [inline, virtual] |
virtual Formatter* decaf::util::logging::Handler::getFormatter | ( | ) | [inline, virtual] |
virtual Level decaf::util::logging::Handler::getLevel | ( | ) | [inline, virtual] |
virtual bool decaf::util::logging::Handler::isLoggable | ( | const LogRecord & | record | ) | const [virtual] |
Check if this Handler would actually log a given LogRecord.
This method checks if the LogRecord has an appropriate Level and whether it satisfies any Filter. It also may make other Handler specific checks that might prevent a handler from logging the LogRecord.
record | LogRecord to check |
Reimplemented in decaf::util::logging::StreamHandler.
virtual void decaf::util::logging::Handler::publish | ( | const LogRecord & | record | ) | [pure virtual] |
Publish the Log Record to this Handler.
record | The Log Record to Publish |
Implemented in decaf::util::logging::ConsoleHandler, and decaf::util::logging::StreamHandler.
void decaf::util::logging::Handler::reportError | ( | const std::string & | message, |
decaf::lang::Exception * | ex, | ||
int | code | ||
) | [protected] |
Protected convenience method to report an error to this Handler's ErrorManager.
message | - a descriptive string (may be empty) |
ex | - an exception (may be NULL) |
code | - an error code defined in ErrorManager |
virtual void decaf::util::logging::Handler::setErrorManager | ( | ErrorManager * | errorManager | ) | [virtual] |
Sets the Formatter
used by this Handler.
The ErrorManager's "error" method will be invoked if any errors occur while using this Handler.
errorManager | ErrorManager derived instance |
virtual void decaf::util::logging::Handler::setFilter | ( | Filter * | filter | ) | [inline, virtual] |
virtual void decaf::util::logging::Handler::setFormatter | ( | Formatter * | formatter | ) | [virtual] |
virtual void decaf::util::logging::Handler::setLevel | ( | const Level & | value | ) | [inline, virtual] |