LogChannel
LogChannel
#include <icy/logger.h>Subclassed by:
ConsoleChannel,FileChannel,RotatingFileChannel
Named log output channel with configurable severity level and formatting.
Public Methods
| Return | Name | Description |
|---|---|---|
LogChannel | #### Parameters | |
void | write virtual | Writes a log stream entry to this channel. |
void | write virtual | Writes a plain message to this channel. |
void | format virtual | Formats a log stream entry into the given output stream. |
std::string | name const inline | Returns the channel name. |
Level | level const inline | Returns the minimum severity level. |
std::string | timeFormat const inline | Returns the timestamp format string. |
void | setLevel inline | Sets the minimum severity level. |
void | setTimeFormat inline | Sets the timestamp format string. |
void | setFilter inline | Sets a realm filter; only messages whose realm matches are written. |
LogChannel
LogChannel(std::string name, Level level, std::string timeFormat)Parameters
nameUnique channel name.levelMinimum severity level; messages below this level are dropped.timeFormatstrftime-compatible format string for timestamps.
write
virtual
virtual void write(const LogStream & stream)Writes a log stream entry to this channel.
Parameters
streamThe log stream to write.
write
virtual
virtual void write(std::string message, Level level, std::string realm)Writes a plain message to this channel.
Parameters
messageLog message text.levelSeverity level for the message.realmOptional source realm (e.g. file or class name).
format
virtual
virtual void format(const LogStream & stream, std::ostream & ost)Formats a log stream entry into the given output stream.
Parameters
streamThe log stream to format.ostThe output stream to write the formatted message into.
name
const inline
inline std::string name() constReturns the channel name.
level
const inline
inline Level level() constReturns the minimum severity level.
timeFormat
const inline
inline std::string timeFormat() constReturns the timestamp format string.
setLevel
inline
inline void setLevel(Level level)Sets the minimum severity level.
Parameters
levelMessages below this level are dropped.
setTimeFormat
inline
inline void setTimeFormat(std::string format)Sets the timestamp format string.
Parameters
formatstrftime-compatible format string.
setFilter
inline
inline void setFilter(std::string filter)Sets a realm filter; only messages whose realm matches are written.
Parameters
filterRealm substring or pattern to match against.
Protected Attributes
| Return | Name | Description |
|---|---|---|
std::string | _name | |
Level | _level | |
std::string | _timeFormat | |
std::string | _filter |
_name
std::string _name_level
Level _level_timeFormat
std::string _timeFormat_filter
std::string _filter