1 #ifndef __SDR_LOGGER_HH__
2 #define __SDR_LOGGER_HH__
35 LogLevel
level()
const;
37 inline std::string
message()
const {
return this->str(); }
115 #endif // __SDR_LOGGER_HH__
Base class of all log-message handlers.
Definition: logger.hh:46
void addHandler(LogHandler *handler)
Adds a message handler.
Definition: logger.cc:95
Definition: autocast.hh:8
LogLevel level() const
Returns the level of the message.
Definition: logger.cc:26
virtual ~LogHandler()
Destructor.
Definition: logger.cc:38
virtual ~Logger()
Destructor.
Definition: logger.cc:80
std::list< LogHandler * > _handler
All registered handlers.
Definition: logger.hh:110
StreamLogHandler(std::ostream &stream, LogLevel level)
Constructor.
Definition: logger.cc:46
virtual void handle(const LogMessage &msg)
Handles the message.
Definition: logger.cc:57
LogMessage(LogLevel level, const std::string &msg="")
Constructor.
Definition: logger.cc:9
virtual void handle(const LogMessage &msg)=0
Needs to be implemented by sub-classes to handle log messages.
std::ostream & _stream
The output stream.
Definition: logger.hh:78
void log(const LogMessage &message)
Logs a message.
Definition: logger.cc:100
LogHandler()
Hidden constructor.
Definition: logger.cc:34
virtual ~StreamLogHandler()
Destructor.
Definition: logger.cc:52
virtual ~LogMessage()
Destructor.
Definition: logger.cc:21
A log message.
Definition: logger.hh:22
Serializes log message into the specified stream.
Definition: logger.hh:62
LogLevel _level
The minimum log-level.
Definition: logger.hh:80
Logger()
Hidden constructor.
Definition: logger.cc:74
std::string message() const
Returns the message.
Definition: logger.hh:37
The logger class (singleton).
Definition: logger.hh:86
LogLevel _level
The level of the message.
Definition: logger.hh:41
static Logger * _instance
The singleton instance.
Definition: logger.hh:108