Home -> ILogTarget

Declaration

class ILogTarget;

Description

The ILogTarget interface is the base class for objects that receive accepted log messages from LogManager. A target is responsible for final delivery, such as writing to a file, forwarding to a callback, or displaying output in a console.

It is valid and supported to derive from ILogTarget to implement custom logging targets. Custom targets should implement LogMessage to consume the supplied scope, severity, and message data, and Delete to destroy the concrete object.

In typical usage, a custom target is not required. LogTargetCallback can be used to bridge the logging system to another environment, capture messages for tests, or forward them into an existing logging framework.

ImportantImportant

The scope and message parameters supplied to LogMessage include explicit lengths. Custom targets should respect those lengths and should not require the pointers to be null terminated.

ImportantImportant

The log manager serializes calls to LogMessage for a given target, so custom targets do not need to add their own synchronization for normal use.

Structures

Name Description
Public Struct Deleter
Deletes log target objects held by ILogTarget::unique_ptr.

Members

Lifetime methods

Name Description
Public member Delete
Deletes the log target object.

Logging methods

Name Description
Public member LogMessage
Receives a log message for final delivery by the target.

See also