Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::LogBackendCout Class Reference

Default console backend of the MITK log mechanism. More...

#include <mitkLogBackendCout.h>

Inheritance diagram for mitk::LogBackendCout:
Collaboration diagram for mitk::LogBackendCout:

Public Member Functions

 LogBackendCout ()
 Construct a console backend with smart/short formatting mode (default). More...
 
 ~LogBackendCout () override
 
void ProcessMessage (const LogMessage &message) override
 Format and write the log message to std::cout. More...
 
void SetFull (bool full)
 Set the formatting mode. More...
 
OutputType GetOutputType () const override
 Return the output type of this backend. More...
 
- Public Member Functions inherited from mitk::LogBackendText
 ~LogBackendText () override
 
- Public Member Functions inherited from mitk::LogBackendBase
virtual ~LogBackendBase ()
 

Additional Inherited Members

- Public Types inherited from mitk::LogBackendBase
enum class  OutputType { Console , File , Other }
 Classification of the output destination of a backend. More...
 
- Protected Member Functions inherited from mitk::LogBackendText
void FormatSmart (const LogMessage &message, int threadID=0)
 Format the given message in smart/short format and write it to std::cout. More...
 
void FormatFull (const LogMessage &message, int threadID=0)
 Format the given message in full/long format and write it to std::cout. More...
 
void FormatSmart (std::ostream &out, const LogMessage &message, int threadID=0)
 Format the given message in smart/short format and write it to the given stream. More...
 
void FormatFull (std::ostream &out, const LogMessage &message, int threadID=0)
 Format the given message in full/long format and write it to the given stream. More...
 
void AppendTimeStamp (std::ostream &out)
 Append the current wall-clock time to the given stream. More...
 
void FormatSmartWindows (const LogMessage &message, int threadID)
 Format a message in smart/short format with colored Windows console output. More...
 

Detailed Description

Default console backend of the MITK log mechanism.

Formats log messages as human-readable text and writes them to std::cout. This backend is automatically instantiated and registered when no other backend has been registered at the time a log message is emitted. It is automatically unregistered when a user backend is added.

Two formatting modes are supported:

  • Smart/short (default): Compact format with relative timestamps and level indicators.
  • Full/long: Verbose pipe-delimited format suitable for post-processing.
See also
LogBackendText, RegisterBackend()

Definition at line 33 of file mitkLogBackendCout.h.

Constructor & Destructor Documentation

◆ LogBackendCout()

mitk::LogBackendCout::LogBackendCout ( )

Construct a console backend with smart/short formatting mode (default).

◆ ~LogBackendCout()

mitk::LogBackendCout::~LogBackendCout ( )
override

Member Function Documentation

◆ GetOutputType()

OutputType mitk::LogBackendCout::GetOutputType ( ) const
overridevirtual

Return the output type of this backend.

Returns
Always returns OutputType::Console.

Implements mitk::LogBackendBase.

◆ ProcessMessage()

void mitk::LogBackendCout::ProcessMessage ( const LogMessage &  message)
overridevirtual

Format and write the log message to std::cout.

Delegates to FormatFull() or FormatSmart() depending on the current formatting mode.

Parameters
[in]messageThe log message to process.

Implements mitk::LogBackendText.

◆ SetFull()

void mitk::LogBackendCout::SetFull ( bool  full)

Set the formatting mode.

Parameters
[in]fullIf true, use the full/long format which includes all metadata (file path, line number, function name, thread ID, module name) in a pipe-delimited layout suitable for post-processing. If false (default), use the smart/short format with compact timestamps and level indicators.

The documentation for this class was generated from the following file: