Base module

LogChannel

Named log output channel with configurable severity level and formatting.

#include <icy/logger.h>

class LogChannel

Defined in src/base/include/icy/logger.h:384

Public Methods

ReturnNameDescription
LogChannel
~LogChannel virtualDefaulted destructor.
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 = Level::Debug, std::string timeFormat = "%H:%M:%S")

Defined in src/base/include/icy/logger.h:390

Parameters

ParameterTypeDescription
namestd::stringUnique channel name.
levelLevelMinimum severity level; messages below this level are dropped.
timeFormatstd::stringstrftime-compatible format string for timestamps.

~LogChannel

virtual

virtual ~LogChannel() = default

Defined in src/base/include/icy/logger.h:392

Defaulted destructor.


write

virtual

virtual void write(const LogStream & stream)

Defined in src/base/include/icy/logger.h:396

Writes a log stream entry to this channel.

Reimplemented by

Parameters

ParameterTypeDescription
streamconst LogStream &The log stream to write.

write

virtual

virtual void write(std::string message, Level level = Level::Debug, std::string realm = "")

Defined in src/base/include/icy/logger.h:402

Writes a plain message to this channel.

Parameters

ParameterTypeDescription
messagestd::stringLog message text.
levelLevelSeverity level for the message.
realmstd::stringOptional source realm (e.g. file or class name).

format

virtual

virtual void format(const LogStream & stream, std::ostream & ost)

Defined in src/base/include/icy/logger.h:408

Formats a log stream entry into the given output stream.

Parameters

ParameterTypeDescription
streamconst LogStream &The log stream to format.
oststd::ostream &The output stream to write the formatted message into.

name

const inline

inline std::string name() const

Defined in src/base/include/icy/logger.h:411

Returns the channel name.


level

const inline

inline Level level() const

Defined in src/base/include/icy/logger.h:414

Returns the minimum severity level.


timeFormat

const inline

inline std::string timeFormat() const

Defined in src/base/include/icy/logger.h:417

Returns the timestamp format string.


setLevel

inline

inline void setLevel(Level level)

Defined in src/base/include/icy/logger.h:421

Sets the minimum severity level.

Parameters

ParameterTypeDescription
levelLevelMessages below this level are dropped.

setTimeFormat

inline

inline void setTimeFormat(std::string format)

Defined in src/base/include/icy/logger.h:429

Sets the timestamp format string.

Parameters

ParameterTypeDescription
formatstd::stringstrftime-compatible format string.

setFilter

inline

inline void setFilter(std::string filter)

Defined in src/base/include/icy/logger.h:433

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

Parameters

ParameterTypeDescription
filterstd::stringRealm substring or pattern to match against.

Protected Attributes

ReturnNameDescription
std::string_name
Level_level
std::string_timeFormat
std::string_filter

_name

std::string _name

Defined in src/base/include/icy/logger.h:436


_level

Level _level

Type: Level

Defined in src/base/include/icy/logger.h:437


_timeFormat

std::string _timeFormat

Defined in src/base/include/icy/logger.h:438


_filter

std::string _filter

Defined in src/base/include/icy/logger.h:439