Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::LogBackendBase Class Referenceabstract

Abstract interface for log backends that can be registered in the MITK log mechanism. More...

#include <mitkLogBackendBase.h>

Inheritance diagram for mitk::LogBackendBase:

Public Types

enum class  OutputType { Console , File , Other }
 Classification of the output destination of a backend. More...
 

Public Member Functions

virtual ~LogBackendBase ()
 
virtual void ProcessMessage (const LogMessage &message)=0
 Process a log message. More...
 
virtual OutputType GetOutputType () const =0
 Return the output type of this backend. More...
 

Detailed Description

Abstract interface for log backends that can be registered in the MITK log mechanism.

Subclasses implement ProcessMessage() to handle log events (e.g. writing to console, file, or a remote logging service). Backends are registered and unregistered via mitk::RegisterBackend() and mitk::UnregisterBackend(). Backends of a given OutputType can be collectively enabled or disabled via EnableBackends() / DisableBackends().

If no backend is registered when a log message is emitted, a default LogBackendCout instance is created automatically. This default backend is removed as soon as a user-registered backend is added.

See also
RegisterBackend(), UnregisterBackend(), LogBackendText, LogBackendCout

Definition at line 34 of file mitkLogBackendBase.h.

Member Enumeration Documentation

◆ OutputType

Classification of the output destination of a backend.

Used by EnableBackends() / DisableBackends() to selectively enable or disable groups of backends by their output type.

Enumerator
Console 

Backend writes to the console (stdout/stderr).

File 

Backend writes to a file.

Other 

Backend writes to another destination (e.g. network, GUI widget).

Definition at line 42 of file mitkLogBackendBase.h.

Constructor & Destructor Documentation

◆ ~LogBackendBase()

virtual mitk::LogBackendBase::~LogBackendBase ( )
virtual

Member Function Documentation

◆ GetOutputType()

virtual OutputType mitk::LogBackendBase::GetOutputType ( ) const
pure virtual

Return the output type of this backend.

Used by the log mechanism to determine whether this backend is enabled.

Returns
The OutputType classification of this backend.

Implemented in mitk::LogBackendCout, and mitk::LogBackend.

◆ ProcessMessage()

virtual void mitk::LogBackendBase::ProcessMessage ( const LogMessage &  message)
pure virtual

Process a log message.

Called by the MITK log mechanism for each registered and enabled backend whenever a log message is emitted. Implementations should format and output the message according to their destination.

Parameters
[in]messageThe log message to process. The message text has already been trimmed of trailing whitespace.
Precondition
The backend is registered via RegisterBackend() and its OutputType is enabled.

Implemented in mitk::LogBackendText, mitk::LogBackendCout, and mitk::LogBackend.


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