|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Stream-based log message builder for the MITK log mechanism. More...
#include <mitkLog.h>

Public Member Functions | |
| PseudoLogStream (LogLevel level, const std::string &filePath, int lineNumber, const std::string &functionName) | |
| Construct a log stream for a message at the given level and source location. More... | |
| ~PseudoLogStream () | |
| Destructor that distributes the assembled log message to all backends. More... | |
| template<class T > | |
| PseudoLogStream & | operator<< (const T &data) |
| Stream data into the log message (const reference overload). More... | |
| template<class T > | |
| PseudoLogStream & | operator<< (T &data) |
| Stream data into the log message (non-const reference overload). More... | |
| PseudoLogStream & | operator<< (std::ostream &(*func)(std::ostream &)) |
Stream manipulator overload (e.g. std::endl, std::flush). More... | |
| PseudoLogStream & | operator() (const std::string &category) |
| Set or append a category for this log message. More... | |
| PseudoLogStream & | operator() (bool enabled) |
| Conditionally enable or disable this log stream. More... | |
Protected Attributes | |
| bool | m_Disabled |
| LogMessage | m_Message |
| std::stringstream | m_Stream |
Stream-based log message builder for the MITK log mechanism.
Provides an std::ostream-like interface for constructing log messages. Data streamed via operator<< is accumulated in an internal string stream. Upon destruction, the assembled message is distributed to all registered and enabled backends via DistributeToBackends().
All streaming operations use the "C" locale to ensure consistent numeric formatting regardless of the application's locale settings.
This class should not be instantiated directly. Use the convenience macros MITK_INFO, MITK_WARN, MITK_ERROR, MITK_FATAL, and MITK_DEBUG instead.
Example:
|
inline |
Construct a log stream for a message at the given level and source location.
| [in] | level | Severity level of the log message. |
| [in] | filePath | Source file path (typically FILE). |
| [in] | lineNumber | Source line number (typically LINE). |
| [in] | functionName | Source function name (typically FUNCTION). |
|
inline |
Destructor that distributes the assembled log message to all backends.
If the stream has not been disabled, the accumulated message text and the module name (from MITKLOG_MODULENAME) are set on the internal LogMessage, which is then passed to DistributeToBackends().
Definition at line 159 of file mitkLog.h.
References mitk::DistributeToBackends(), and MITKLOG_MODULENAME.
|
inline |
Conditionally enable or disable this log stream.
When called with false, the stream is disabled: all subsequent streaming operations become no-ops and the message will not be distributed to backends. Once disabled, the stream cannot be re-enabled.
| [in] | enabled | If false, disables this stream. If true, no effect (the stream remains in its current state). |
Example:
|
inline |
Set or append a category for this log message.
Categories help organize log output by topic or subsystem. If a category has already been set, the new category is appended with a dot separator (e.g. calling with "a" then "b" yields "a.b").
If the stream is disabled, this is a no-op.
| [in] | category | The category string to set or append. |
Example:
|
inline |
Stream data into the log message (const reference overload).
Appends the string representation of data to the internal message stream using the "C" locale. If the stream is disabled, this is a no-op.
| T | Type of the data to stream. Must support operator<< with std::ostream. |
| [in] | data | The data to append to the log message. |
|
inline |
Stream manipulator overload (e.g. std::endl, std::flush).
Applies the given stream manipulator to the internal message stream. If the stream is disabled, this is a no-op.
| [in] | func | A stream manipulator function (e.g. std::endl). |
|
inline |
Stream data into the log message (non-const reference overload).
Appends the string representation of data to the internal message stream using the "C" locale. If the stream is disabled, this is a no-op.
| T | Type of the data to stream. Must support operator<< with std::ostream. |
| [in] | data | The data to append to the log message. |
|
protected |
|
protected |