Home -> ILogger

Declaration

class ILogger;

Description

The ILogger interface is the public logging surface used by application and library code to emit scoped log messages. A logger has a scope string and accepts messages tagged with an Severity value.

The interface deliberately does not specify where messages are written. Concrete implementations decide whether a severity is enabled, how child scopes are created, and how accepted messages are delivered to log targets.

String messages can be supplied as UTF-8 std::string values or native std::wstring values. Wide strings are converted to UTF-8 before the message is passed to the concrete logger implementation.

ImportantImportant

Use IsLogSeverityEnabled before doing expensive work to construct a message. The built-in formatting overloads perform this check before resolving format arguments.

WarningWarning

The format-string overloads use positional placeholders such as {0} and {1}. Placeholder values must be numeric and must refer to supplied arguments.

Enumerations

Name Description
Public Enum Severity
Defines the severity assigned to an individual log message.
Public Enum SeverityFilter
Defines bit-mask filters used to include or exclude messages by severity.

Structures

Name Description
Public Struct Deleter
Deletes logger objects held by ILogger::unique_ptr.

Members

Lifetime methods

Name Description
Public member Delete
Deletes the logger object. Objects are normally destroyed through ILogger::unique_ptr.

Scope methods

Name Description
Public member GetScope
Returns the scope string assigned to the logger.

Severity methods

Name Description
Public member IsLogSeverityEnabled
Reports whether a message with the supplied severity would currently be accepted by the logger.

Logger creation methods

Name Description
Public member CloneLogger
Creates another logger object which logs to the same destination and scope.
Public member GetLoggerChildScope
Creates a logger for a child scope below the current logger scope.

Logging methods

Name Description
Public member Log
Logs a message using the severity supplied by the caller.
Public member Critical
Logs a critical severity message.
Public member Error
Logs an error severity message.
Public member Warning
Logs a warning severity message.
Public member Info
Logs an informational severity message.
Public member Debug
Logs a debug severity message.
Public member Trace
Logs a trace severity message.

See also