Home -> LogTargetConsole

Declaration

class LogTargetConsole : public ILogTarget;

Description

The LogTargetConsole class is a Windows console ILogTarget implementation. It writes messages to the attached console and changes the console text colour based on message severity.

This target is compiled only when the INCLUDE_LOGTARGETCONSOLE preprocessor symbol is enabled. It opens the attached console through CONOUT$ rather than assuming the standard output handle is a console.

ImportantImportant

Call OpenConsoleHandle before expecting messages to appear. If no console handle is open, LogMessage returns without writing output.

Members

Constructors

Name Description
Public member Constructor
Creates a console target with no console handle open.
Public member Create
Creates a console target wrapped in a smart pointer.

Lifetime methods

Name Description
Public member Delete
Deletes the console target.

Open methods

Name Description
Public member OpenConsoleHandle
Opens a handle to the attached console.
Public member CloseConsoleHandle
Closes the console handle if one is open.

Logging methods

Name Description
Public member LogMessage
Writes a message to the attached console.

See also