Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitkLogBackend.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkLogBackend_h
14 #define mitkLogBackend_h
15 
16 #include <mitkLogBackendText.h>
17 #include <MitkCoreExports.h>
18 
19 namespace mitk
20 {
24  {
25  public:
26  void ProcessMessage(const LogMessage&) override;
27 
30  static void Register();
31 
34  static void Unregister();
35 
38  static void SetLogFile(const std::string& file);
39 
63  static void RotateLogFiles(const std::string& prefixPath);
64 
83  static std::string IncrementLogFileNames(const std::string& prefixPath, int numLogFiles = 10);
84 
87  static std::string GetLogFile();
88 
93  static void EnableAdditionalConsoleWindow(bool enable);
94 
98  static void CatchLogFileCommandLineParameter(int& argc, char** argv);
99 
101 
102  protected:
107  static bool CheckIfFileExists(const std::string &filename);
108  };
109 }
110 
111 #endif
#define MITKCORE_EXPORT
Abstract superclass for text-based log backends.
Log backend implementation for MITK.
static bool CheckIfFileExists(const std::string &filename)
Check if a file exists.
static void CatchLogFileCommandLineParameter(int &argc, char **argv)
Automatically extract and remove the "--logfile <file>" parameters from the standard C main parameter...
static void SetLogFile(const std::string &file)
Set extra log file path in addition to the console log.
static std::string IncrementLogFileNames(const std::string &prefixPath, int numLogFiles=10)
Increment the names of logfiles with the given prefixPath.
void ProcessMessage(const LogMessage &) override
Called by the MITK log mechanism if the object is registered and a log message is emitted.
static void Register()
Registers MITK log backend.
static std::string GetLogFile()
static void RotateLogFiles(const std::string &prefixPath)
Activates and handles a rolling log file with the given prefix and path.
static void Unregister()
Unregister MITK log backend.
static void EnableAdditionalConsoleWindow(bool enable)
Enable an additional logging output window by means of itk::OutputWindow.
LogBackendBase::OutputType GetOutputType() const override
Find image slices visible on a given plane.
A single log message (log event) of the MITK log mechanism.