Base module

LogChannel

Named log output channel with configurable severity level and formatting.

LogChannel

#include <icy/logger.h>

Subclassed by: ConsoleChannel, FileChannel, RotatingFileChannel

Named log output channel with configurable severity level and formatting.

Public Methods

ReturnNameDescription
LogChannel#### Parameters
voidwrite virtualWrites a log stream entry to this channel.
voidwrite virtualWrites a plain message to this channel.
voidformat virtualFormats a log stream entry into the given output stream.
std::stringname const inlineReturns the channel name.
Levellevel const inlineReturns the minimum severity level.
std::stringtimeFormat const inlineReturns the timestamp format string.
voidsetLevel inlineSets the minimum severity level.
voidsetTimeFormat inlineSets the timestamp format string.
voidsetFilter inlineSets a realm filter; only messages whose realm matches are written.

LogChannel

LogChannel(std::string name, Level level, std::string timeFormat)

Parameters

  • name Unique channel name.

  • level Minimum severity level; messages below this level are dropped.

  • timeFormat strftime-compatible format string for timestamps.


write

virtual

virtual void write(const LogStream & stream)

Writes a log stream entry to this channel.

Parameters

  • stream The 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

  • message Log message text.

  • level Severity level for the message.

  • realm Optional 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

  • stream The log stream to format.

  • ost The output stream to write the formatted message into.


name

const inline

inline std::string name() const

Returns the channel name.


level

const inline

inline Level level() const

Returns the minimum severity level.


timeFormat

const inline

inline std::string timeFormat() const

Returns the timestamp format string.


setLevel

inline

inline void setLevel(Level level)

Sets the minimum severity level.

Parameters

  • level Messages below this level are dropped.

setTimeFormat

inline

inline void setTimeFormat(std::string format)

Sets the timestamp format string.

Parameters

  • format strftime-compatible format string.

setFilter

inline

inline void setFilter(std::string filter)

Sets a realm filter; only messages whose realm matches are written.

Parameters

  • filter Realm substring or pattern to match against.

Protected Attributes

ReturnNameDescription
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