Computer Assited Medical Intervention Tool Kit  version 5.0
InterfaceLogger.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef INTERFACELOGGER_H
27 #define INTERFACELOGGER_H
28 
29 // -- Core stuff
30 #include "CamiTKAPI.h"
31 
32 class QObject;
33 
34 #include <QDir>
35 #include <QFileInfo>
36 
37 namespace camitk {
38 
52 
53 public:
54 
55 #ifdef ERROR
56 #define CAMITK_WINDOWS_SYSTEM_ERROR_SAFEGUARD ERROR
57 #undef ERROR
58 #endif
59  enum LogLevel {
61  NONE = 0,
62  ERROR = 1,
63  WARNING = 2,
64  INFO = 3,
65  TRACE = 4,
66  };
67 
68 #ifdef CAMITK_WINDOWS_SYSTEM_ERROR_SAFEGUARD
69 #define ERROR CAMITK_WINDOWS_SYSTEM_ERROR_SAFEGUARD
70 #endif
71 
73  virtual ~InterfaceLogger() = default;
74 
77  virtual LogLevel getLogLevel() = 0;
78 
81  virtual void setLogLevel(LogLevel level) = 0;
82 
85  virtual void setLogToStandardOutput(bool writeToStdOut) = 0;
86 
90  virtual bool getLogToStandardOutput() = 0;
91 
99  virtual bool setLogToFile(bool writeToFile) = 0;
100 
114  virtual bool setLogFileDirectory(QDir directoryName, bool moveExistingLogFile = true) = 0;
115 
117  virtual bool getLogToFile() = 0;
118 
120  virtual QFileInfo getLogFileInfo() = 0;
121 
125  virtual void setMessageBoxLevel(LogLevel level) = 0;
126 
128  virtual LogLevel getMessageBoxLevel() = 0;
129 
134  virtual void setDebugInformation(bool) = 0;
135 
137  virtual bool getDebugInformation() = 0;
138 
144  virtual void setTimeStampInformation(bool showTimeStamp) = 0;
145 
147  virtual bool getTimeStampInformation() = 0;
148 
160  virtual QString log(const QString msg, const LogLevel level, char const* fileName, char const* methodName, int lineNumber, const QObject* sender = nullptr) = 0;
161 };
162 
163 }
164 
165 #endif // INTERFACELOGGER_H
CamiTKAPI.h
camitk::InterfaceLogger::LogLevel
LogLevel
Definition: InterfaceLogger.h:60
camitk::InterfaceLogger
The CamiTK logger interface provides a flexible tracing system to CamiTK applications....
Definition: InterfaceLogger.h:51
CAMITK_API
#define CAMITK_API
Definition: CamiTKAPI.h:49
camitk
Definition: Action.cpp:35