Description

The Cobalt logging system is split into a lightweight interface library and a concrete implementation library. The LoggingInterface library defines the ILogger interface used by code that emits log messages, along with NullLogger for situations where logging should be accepted but discarded.

The Logging library provides the standard implementation around LogManager. A log manager creates scoped Logger instances, owns one or more ILogTarget objects, filters messages by severity, and forwards accepted messages to each target.

Log targets are responsible for final delivery. The implementation library includes targets for callbacks, files, standard output, and Windows console output. In typical applications, LogTargetCallback is usually enough to bridge the logging system to another logging framework or capture mechanism, and custom ILogTarget implementations are only needed for specialised delivery requirements.

ImportantImportant

Logger instances are safe to use concurrently from multiple threads. The logging system serializes message delivery through the log manager.

ImportantImportant

Logging objects use custom unique_ptr aliases with deleters that call the virtual Delete or Delete method. Prefer the provided smart pointer aliases when transferring ownership.

WarningWarning

The log manager owns its targets and concrete loggers reference their originating manager. A LogManager object must outlive every Logger created from it.

See also