Home
Base module

LogChannel

Named log output channel with configurable severity level and formatting.

LogChannel

#include <icy/logger.h>
class LogChannel

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

Subclassed by: ConsoleChannel, FileChannel, RotatingFileChannel

Named log output channel with configurable severity level and formatting.

List of all members

NameKindOwner
LogChannelfunctionDeclared here
~LogChannelfunctionDeclared here
writefunctionDeclared here
writefunctionDeclared here
formatfunctionDeclared here
namefunctionDeclared here
levelfunctionDeclared here
timeFormatfunctionDeclared here
setLevelfunctionDeclared here
setTimeFormatfunctionDeclared here
setFilterfunctionDeclared here
_namevariableDeclared here
_levelvariableDeclared here
_timeFormatvariableDeclared here
_filtervariableDeclared here

Public Methods

ReturnNameDescription
LogChannel
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:352

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)

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

Writes a log stream entry to this channel.

Parameters

  • stream The log stream to write.
Reimplemented by

write

virtual

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

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

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)

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

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

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

Returns the channel name.


level

const inline

inline Level level() const

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

Returns the minimum severity level.


timeFormat

const inline

inline std::string timeFormat() const

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

Returns the timestamp format string.


setLevel

inline

inline void setLevel(Level level)

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

Sets the minimum severity level.

Parameters

  • level Messages below this level are dropped.

setTimeFormat

inline

inline void setTimeFormat(std::string format)

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

Sets the timestamp format string.

Parameters

  • format strftime-compatible format string.

setFilter

inline

inline void setFilter(std::string filter)

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

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

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


_level

Level _level

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


_timeFormat

std::string _timeFormat

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


_filter

std::string _filter

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