Stream based logging Handler. More...
#include <src/main/decaf/util/logging/StreamHandler.h>

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. | |
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. | |
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.
* decaf.util.logging.StreamHandler.level specifies the default level for the Handler (defaults to Level.INFO). * decaf.util.logging.StreamHandler.filter specifies the name of a Filter class to use (defaults to no Filter). * decaf.util.logging.StreamHandler.formatter specifies the name of a Formatter class to use (defaults to decaf.util.logging.SimpleFormatter).
| 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] |
| void decaf::util::logging::StreamHandler::close | ( | bool | closeStream | ) | [protected] |
Closes this handler, but the underlying output stream is only closed if closeStream is true.
| closeStream | whether to close the underlying output stream. |
| 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.
| IOException | if an I/O error occurs. |
Implements decaf::io::Closeable.
Reimplemented in decaf::util::logging::ConsoleHandler.
| 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.
| record | LogRecord to check |
Reimplemented from decaf::util::logging::Handler.
| virtual void decaf::util::logging::StreamHandler::publish | ( | const LogRecord & | record | ) | [virtual] |
Publish the Log Record to this Handler.
| record | The 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 | ) | [protected, virtual] |
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.
| stream | The new output stream. May not be NULL. |
| NullPointerException | if the passed stream is NULL. |
1.6.1