 |
Computer Assited Medical Intervention Tool Kit
version 4.1
|
Go to the documentation of this file.
26 #ifndef CAMITKLOGGER_H
27 #define CAMITKLOGGER_H
138 void setLogLevel(
LogLevel level)
override;
142 void setLogToStandardOutput(
bool writeToStdOut)
override;
147 bool getLogToStandardOutput()
override;
156 bool setLogToFile(
bool writeToFile)
override;
174 bool setLogFileDirectory(QDir directoryName,
bool moveExistingLogFile =
true)
override;
177 bool getLogToFile()
override;
180 QFileInfo getLogFileInfo()
override;
187 void setMessageBoxLevel(
LogLevel level)
override;
190 LogLevel getMessageBoxLevel()
override;
196 void setDebugInformation(
bool)
override;
199 bool getDebugInformation()
override;
206 void setTimeStampInformation(
bool showTimeStamp)
override;
209 bool getTimeStampInformation()
override;
222 QString log(
const QString msg,
const LogLevel level,
char const* fileName,
char const* methodName,
int lineNumber,
const QObject* sender =
nullptr)
override;
227 virtual QString buildLogMessage(QString message,
LogLevel level,
char const* fileName,
char const* methodName,
int lineNumber,
const QObject* sender =
nullptr);
231 QString getCamiTKAPIInformation(
const QObject* sender);
234 bool openLogFile(
bool moveFile =
false, QFileInfo fileToMove = QFileInfo());
273 #endif // CAMITKLOGGER_H
CamiTKLogger()
Default constructor.
Definition: CamiTKLogger.cpp:71
QFile * logFile
Current log file (the stream is flushed log message by log message)
Definition: CamiTKLogger.h:261
QString getName() const
Get the main window title.
Definition: MainWindow.cpp:199
bool logToStdOut
is the logger currently writing everything to the standard output
Definition: CamiTKLogger.h:246
void setLogLevel(LogLevel level) override
Sets Current verbosity level of the log:
Definition: CamiTKLogger.cpp:97
LogLevel getMessageBoxLevel() override
Definition: CamiTKLogger.cpp:238
bool getLogToStandardOutput() override
check if the logger is currently writing on standard output (std::cout)
Definition: CamiTKLogger.cpp:113
bool displayDebugInformation
display debug information (file/class name, method name and line number)
Definition: CamiTKLogger.h:252
bool openLogFile(bool moveFile=false, QFileInfo fileToMove=QFileInfo())
open the log file,
Definition: CamiTKLogger.cpp:160
void setMessageBoxLevel(LogLevel level) override
Set the lowest log level that will open modal message box for messages instead of (silently/undisrupt...
Definition: CamiTKLogger.cpp:230
bool getDebugInformation() override
Definition: CamiTKLogger.cpp:251
QFileInfo getLogFileInfo() override
Definition: CamiTKLogger.cpp:220
QDir logFileDirectory
Current directory for the log file.
Definition: CamiTKLogger.h:258
@ NONE
No message is logged.
Definition: InterfaceLogger.h:61
This class describes what is a generic Component extension. To add a ComponentExtension to CamiTK cor...
Definition: ComponentExtension.h:80
@ ERROR
Only error messages are logged.
Definition: InterfaceLogger.h:62
QString getCamiTKAPIInformation(const QObject *sender)
Returns CamiTK API description string if and only if sender derived from CamiTK Action.
Definition: CamiTKLogger.cpp:346
QString getName() const
get the name of the action
Definition: Action.h:334
bool logToFile
is the logger currently writing everything to a file
Definition: CamiTKLogger.h:249
virtual QString buildLogMessage(QString message, LogLevel level, char const *fileName, char const *methodName, int lineNumber, const QObject *sender=nullptr)
Builds a log message of correct format.
Definition: CamiTKLogger.cpp:324
This is the default logger for CamiTK.
Definition: CamiTKLogger.h:123
Action class is an abstract class that enables you to build a action (generally on a component)....
Definition: Action.h:230
LogLevel getLogLevel() override
Get Current verbosity level of the log:
Definition: CamiTKLogger.cpp:92
QString log(const QString msg, const LogLevel level, char const *fileName, char const *methodName, int lineNumber, const QObject *sender=nullptr) override
Log a message: If the logger is allowed to write on standard output, it will display the message (and...
Definition: CamiTKLogger.cpp:269
~CamiTKLogger() override
Destructor.
Definition: CamiTKLogger.cpp:86
InterfaceLogger::LogLevel level
current log level
Definition: CamiTKLogger.h:240
The generic/default application. Once this class is intanciated in the main, everything is setup....
Definition: Application.h:63
InterfaceLogger::LogLevel messageBoxLevel
current level for message boxes
Definition: CamiTKLogger.h:243
void setLogToStandardOutput(bool writeToStdOut) override
Allows the logger to write on std::cout.
Definition: CamiTKLogger.cpp:105
QTextStream * logStream
Current stream to output to the log file.
Definition: CamiTKLogger.h:264
@ INFO
information, warning and error messages are logged
Definition: InterfaceLogger.h:64
bool getLogToFile() override
check if the logger is currently writing on a file
Definition: CamiTKLogger.cpp:155
QString getName() const override
get the name to be displayed
Definition: sdk/libraries/core/component/Component.h:849
void setTimeStampInformation(bool showTimeStamp) override
By default a logger should always show the time-stamp in the form of "yyyy-MM-dd HH:mm:ss....
Definition: CamiTKLogger.cpp:256
LogLevel
Definition: InterfaceLogger.h:60
QDateTime logStartTime
instantiation time
Definition: CamiTKLogger.h:267
bool displayTimeStampInformation
display time stamp information (in the form "yyyy-MM-dd HH:mm:ss.zzz")
Definition: CamiTKLogger.h:255
void setDebugInformation(bool) override
Allows the logger to add debug information to the log message.
Definition: CamiTKLogger.cpp:243
@ WARNING
Only Warning and Error messages are logged.
Definition: InterfaceLogger.h:63
static QString getName()
get the application name
Definition: Application.cpp:201
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: MainWindow.h:85
This class describes what is a generic Action extension. To add a ActionExtension to CamiTK core,...
Definition: ActionExtension.h:82
Viewer is an abstract viewer.
Definition: Viewer.h:55
bool setLogFileDirectory(QDir directoryName, bool moveExistingLogFile=true) override
Set the specific directory to write to (default is the subdirectory "CamiTK" in the system temporary ...
Definition: CamiTKLogger.cpp:134
static QString getLevelAsString(InterfaceLogger::LogLevel level)
get the enum value as a text
Definition: Log.cpp:82
void closeLogFile()
close the current log file and reset state
Definition: CamiTKLogger.cpp:203
@ TRACE
all types of messages are logged
Definition: InterfaceLogger.h:65
virtual QString getName()=0
returns the action extension name (to be overriden in your ActionExtension)
virtual QString getName() const =0
bool setLogToFile(bool writeToFile) override
Allows the logger to write to the log file.
Definition: CamiTKLogger.cpp:118
The CamiTK logger interface provides a flexible tracing system to CamiTK applications....
Definition: InterfaceLogger.h:51
bool getTimeStampInformation() override
Definition: CamiTKLogger.cpp:264
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:298
#define CAMITK_API
Definition: CamiTKAPI.h:49
Definition: Action.cpp:36