Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::LogMessage Struct Reference

A single log message (log event) of the MITK log mechanism. More...

#include <mitkLogMessage.h>

Collaboration diagram for mitk::LogMessage:

Public Member Functions

 LogMessage (const LogLevel level, const std::string &filePath, const int lineNumber, const std::string &functionName)
 Construct a log message with source location information. More...
 

Public Attributes

const LogLevel Level
 Severity level of the log message. More...
 
const std::string FilePath
 Absolute or relative path of the source file where the log message was emitted. More...
 
const int LineNumber
 Line number in the source file where the log message was emitted. More...
 
const std::string FunctionName
 Name of the function or method where the log message was emitted. More...
 
std::string ModuleName
 Name of the MITK module where the log message was emitted. More...
 
std::string Category
 Optional user-defined category for the log event. More...
 
std::string Message
 The actual log message text. More...
 

Detailed Description

A single log message (log event) of the MITK log mechanism.

Encapsulates all metadata and content for a single log event, including source location, severity level, module name, optional category, and the message text.

Log messages should only be created by the macros provided in mitkLog.h (MITK_INFO, MITK_WARN, MITK_ERROR, MITK_FATAL, MITK_DEBUG) through the PseudoLogStream class. Upon destruction of the stream, the message is distributed to all registered backends via DistributeToBackends().

See also
PseudoLogStream, LogBackendBase, DistributeToBackends()

Definition at line 36 of file mitkLogMessage.h.

Constructor & Destructor Documentation

◆ LogMessage()

mitk::LogMessage::LogMessage ( const LogLevel  level,
const std::string &  filePath,
const int  lineNumber,
const std::string &  functionName 
)

Construct a log message with source location information.

Parameters
[in]levelSeverity level of the log message.
[in]filePathAbsolute or relative path of the source file where the message was emitted.
[in]lineNumberLine number in the source file where the message was emitted.
[in]functionNameName of the function or method where the message was emitted.

Member Data Documentation

◆ Category

std::string mitk::LogMessage::Category

Optional user-defined category for the log event.

Categories can be set via the PseudoLogStream::operator()(const std::string&) call. Multiple categories are concatenated with a dot separator (e.g. "module.subsystem").

Definition at line 84 of file mitkLogMessage.h.

◆ FilePath

const std::string mitk::LogMessage::FilePath

Absolute or relative path of the source file where the log message was emitted.

Typically populated by the FILE preprocessor macro.

Definition at line 58 of file mitkLogMessage.h.

◆ FunctionName

const std::string mitk::LogMessage::FunctionName

Name of the function or method where the log message was emitted.

Typically populated by the FUNCTION preprocessor macro.

Definition at line 70 of file mitkLogMessage.h.

◆ Level

const LogLevel mitk::LogMessage::Level

Severity level of the log message.

Set at construction time and remains constant for the lifetime of the message.

Definition at line 52 of file mitkLogMessage.h.

◆ LineNumber

const int mitk::LogMessage::LineNumber

Line number in the source file where the log message was emitted.

Typically populated by the LINE preprocessor macro.

Definition at line 64 of file mitkLogMessage.h.

◆ Message

std::string mitk::LogMessage::Message

The actual log message text.

Assembled from all data streamed into PseudoLogStream via operator<<. Trailing whitespace is trimmed before distribution to backends.

Definition at line 91 of file mitkLogMessage.h.

◆ ModuleName

std::string mitk::LogMessage::ModuleName

Name of the MITK module where the log message was emitted.

Automatically set by PseudoLogStream from the MITKLOG_MODULENAME macro before the message is distributed to backends.

Definition at line 77 of file mitkLogMessage.h.


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