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.
Important
Call OpenConsoleHandle before expecting messages to appear. If no console handle is open, LogMessage returns without writing output.
Members
Constructors
| Name | Description | |
|---|---|---|
| Constructor |
Creates a console target with no console handle open.
|
|
| Create |
Creates a console target wrapped in a smart pointer.
|
Lifetime methods
| Name | Description | |
|---|---|---|
| Delete |
Deletes the console target.
|
Open methods
| Name | Description | |
|---|---|---|
| OpenConsoleHandle |
Opens a handle to the attached console.
|
|
| CloseConsoleHandle |
Closes the console handle if one is open.
|
Logging methods
| Name | Description | |
|---|---|---|
| LogMessage |
Writes a message to the attached console.
|