22 #ifndef MITKLOG_MODULENAME
23 # if defined(US_MODULE_NAME)
24 # define MITKLOG_STR_(x) #x
25 # define MITKLOG_STR(x) MITKLOG_STR_(x)
26 # define MITKLOG_MODULENAME MITKLOG_STR(US_MODULE_NAME)
28 # define MITKLOG_MODULENAME "n/a"
148 m_Message(level, filePath, lineNumber, functionName),
149 m_Stream(std::stringstream::out)
163 m_Message.Message = m_Stream.str();
184 std::locale originalLocale = m_Stream.getloc();
189 m_Stream.imbue(originalLocale);
210 std::locale originalLocale = m_Stream.getloc();
215 m_Stream.imbue(originalLocale);
234 std::locale originalLocale = m_Stream.getloc();
239 m_Stream.imbue(originalLocale);
266 if (m_Message.Category.length())
267 m_Message.Category +=
".";
269 m_Message.Category += category;
292 m_Disabled |= !enabled;
358 #define MITK_INFO mitk::PseudoLogStream(mitk::LogLevel::Info, __FILE__, __LINE__, __FUNCTION__)
365 #define MITK_WARN mitk::PseudoLogStream(mitk::LogLevel::Warn, __FILE__, __LINE__, __FUNCTION__)
372 #define MITK_ERROR mitk::PseudoLogStream(mitk::LogLevel::Error, __FILE__, __LINE__, __FUNCTION__)
379 #define MITK_FATAL mitk::PseudoLogStream(mitk::LogLevel::Fatal, __FILE__, __LINE__, __FUNCTION__)
381 #ifdef MITK_ENABLE_DEBUG_MESSAGES
388 #define MITK_DEBUG mitk::PseudoLogStream(mitk::LogLevel::Debug, __FILE__, __LINE__, __FUNCTION__)
390 #define MITK_DEBUG true ? mitk::NullLogStream() : mitk::NullLogStream()
Abstract interface for log backends that can be registered in the MITK log mechanism.
OutputType
Classification of the output destination of a backend.
No-op log stream that silently discards all input.
NullLogStream & operator()(const char *)
No-op category operator.
NullLogStream & operator()(bool)
No-op enable/disable operator.
NullLogStream & operator<<(T &)
No-op stream operator (non-const reference overload).
NullLogStream & operator<<(const T &)
No-op stream operator (const reference overload).
NullLogStream & operator<<(std::ostream &(*)(std::ostream &))
No-op stream manipulator operator.
Stream-based log message builder for the MITK log mechanism.
PseudoLogStream & operator()(const std::string &category)
Set or append a category for this log message.
~PseudoLogStream()
Destructor that distributes the assembled log message to all backends.
PseudoLogStream & operator<<(std::ostream &(*func)(std::ostream &))
Stream manipulator overload (e.g. std::endl, std::flush).
std::stringstream m_Stream
PseudoLogStream & operator()(bool enabled)
Conditionally enable or disable this log stream.
PseudoLogStream & operator<<(const T &data)
Stream data into the log message (const reference overload).
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.
PseudoLogStream & operator<<(T &data)
Stream data into the log message (non-const reference overload).
#define MITKLOG_MODULENAME
Find image slices visible on a given plane.
LogLevel
Severity levels for log messages in the MITK log mechanism.
void MITKLOG_EXPORT UnregisterBackend(LogBackendBase *backend)
Unregister a previously registered log backend.
void MITKLOG_EXPORT EnableBackends(LogBackendBase::OutputType type)
Enable all backends of the given output type.
void MITKLOG_EXPORT DisableBackends(LogBackendBase::OutputType type)
Disable all backends of the given output type.
void MITKLOG_EXPORT DistributeToBackends(LogMessage &message)
Distribute a log message to all registered and enabled backends.
bool MITKLOG_EXPORT IsBackendEnabled(LogBackendBase::OutputType type)
Check whether backends of the given output type are enabled.
void MITKLOG_EXPORT RegisterBackend(LogBackendBase *backend)
Register a log backend in the MITK log mechanism.
A single log message (log event) of the MITK log mechanism.