activemq-cpp-3.6.0
decaf::util::logging::StreamHandler Class Reference

Stream based logging Handler. More...

#include <src/main/decaf/util/logging/StreamHandler.h>

Inheritance diagram for decaf::util::logging::StreamHandler:

Public Member Functions

 StreamHandler ()
 Create a StreamHandler, with no current output stream.
 StreamHandler (decaf::io::OutputStream *stream, Formatter *formatter)
 Create a StreamHandler, with no current output stream.
virtual ~StreamHandler ()
virtual void close ()
 Close the current output stream.
virtual void flush ()
 Flush the Handler's output, clears any buffers.
virtual void publish (const LogRecord &record)
 Publish the Log Record to this Handler.
virtual bool isLoggable (const LogRecord &record) const
 Check if this Handler would actually log a given LogRecord.
- Public Member Functions inherited from decaf::util::logging::Handler
 Handler ()
virtual ~Handler ()
virtual void setFilter (Filter *filter)
 Sets the Filter that this Handler uses to filter Log Records.
virtual FiltergetFilter ()
 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 FormattergetFormatter ()
 Gets the Formatter used by this Handler.
virtual void setErrorManager (ErrorManager *errorManager)
 Sets the Formatter used by this Handler.
virtual ErrorManagergetErrorManager ()
 Gets the ErrorManager used by this Handler.
- Public Member Functions inherited from decaf::io::Closeable
virtual ~Closeable ()

Protected Member Functions

virtual void setOuputStream (decaf::io::OutputStream *stream)
 Change the output stream.
void close (bool closeStream)
 Closes this handler, but the underlying output stream is only closed if closeStream is true.
- Protected Member Functions inherited from decaf::util::logging::Handler
void reportError (const std::string &message, decaf::lang::Exception *ex, int code)
 Protected convenience method to report an error to this Handler's ErrorManager.

Detailed Description

Stream based logging Handler.

This is primarily intended as a base class or support class to be used in implementing other logging Handlers.

LogRecords are published to a given decaf::io::OutputStream.

Configuration: By default each StreamHandler is initialized using the following LogManager configuration properties. If properties are not defined (or have invalid values) then the specified default values are used.

Since
1.0

Constructor & Destructor Documentation

decaf::util::logging::StreamHandler::StreamHandler ( )

Create a StreamHandler, with no current output stream.

decaf::util::logging::StreamHandler::StreamHandler ( decaf::io::OutputStream stream,
Formatter formatter 
)

Create a StreamHandler, with no current output stream.

virtual decaf::util::logging::StreamHandler::~StreamHandler ( )
virtual

Member Function Documentation

virtual void decaf::util::logging::StreamHandler::close ( )
virtual

Close the current output stream.

The close method will perform a flush and then close the Handler. After close has been called this Handler should no longer be used. Method calls may either be silently ignored or may throw runtime exceptions.

Exceptions
IOExceptionif an I/O error occurs.

Implements decaf::io::Closeable.

Reimplemented in decaf::util::logging::ConsoleHandler.

void decaf::util::logging::StreamHandler::close ( bool  closeStream)
protected

Closes this handler, but the underlying output stream is only closed if closeStream is true.

Parameters
closeStreamwhether to close the underlying output stream.
virtual void decaf::util::logging::StreamHandler::flush ( )
virtual

Flush the Handler's output, clears any buffers.

Implements decaf::util::logging::Handler.

virtual bool decaf::util::logging::StreamHandler::isLoggable ( const LogRecord record) const
virtual

Check if this Handler would actually log a given LogRecord.

Parameters
recordLogRecord to check
Returns
true if the record can be logged with current settings.

Reimplemented from decaf::util::logging::Handler.

virtual void decaf::util::logging::StreamHandler::publish ( const LogRecord record)
virtual

Publish the Log Record to this Handler.

Parameters
recordThe LogRecord to Publish

Implements decaf::util::logging::Handler.

Reimplemented in decaf::util::logging::ConsoleHandler.

virtual void decaf::util::logging::StreamHandler::setOuputStream ( decaf::io::OutputStream stream)
protectedvirtual

Change the output stream.

If there is a current output stream then the Formatter's tail string is written and the stream is flushed and closed. Then the output stream is replaced with the new output stream.

Parameters
streamThe new output stream. May not be NULL.
Exceptions
NullPointerExceptionif the passed stream is NULL.

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