#include <cached_logger.hpp>
Inheritance diagram for CachedLogger:
Public Member Functions | |
CachedLogger (LoggerInterface const &previous_logger) | |
virtual | ~CachedLogger () |
virtual void | log (std::string const &msg, LoggerLevel level) const |
Write a log message. | |
virtual void | error (std::string const &msg) const |
Write an error to a Logger for immediate output. | |
void | flush () const |
Flush the message cache. |
A CachedLogger stores all incoming messages, and writes one copy of each identical message to the previous Logger object in the global stack when the CachedLogger is destroyed, or when the flush() method is invoked.
CachedLogger | ( | LoggerInterface const & | previous_logger | ) |
virtual ~CachedLogger | ( | ) | [virtual] |
void log | ( | std::string const & | msg, | |
LoggerLevel | level | |||
) | const [virtual] |
Write a log message.
This message will be cached and filtered for uniqueness. For immediate output, use the Logger::error() method.
Implements LoggerInterface.
virtual void error | ( | std::string const & | msg | ) | const [virtual] |
Write an error to a Logger for immediate output.
A message passed to this method will be bypass all filtering/caching mechanisms. Use judiciously.
Implements LoggerInterface.
void flush | ( | ) | const |
Flush the message cache.
Writes every message in the message cache to the previous Logger object in the stack.