The CamiTK logger interface provides a flexible tracing system to CamiTK applications. More...
#include <InterfaceLogger.h>
Public Types | |
enum | LogLevel { NONE = 0 , ERROR = 1 , WARNING = 2 , INFO = 3 , TRACE = 4 } |
: how chatty should the log output be... More... | |
Public Member Functions | |
virtual bool | getDebugInformation ()=0 |
virtual QFileInfo | getLogFileInfo ()=0 |
virtual LogLevel | getLogLevel ()=0 |
Get the current verbosity level of the log. More... | |
virtual bool | getLogToFile ()=0 |
check if the logger is currently writing on a file More... | |
virtual bool | getLogToStandardOutput ()=0 |
check if the logger is currently writing on standard output (std::cout) More... | |
virtual LogLevel | getMessageBoxLevel ()=0 |
virtual bool | getTimeStampInformation ()=0 |
virtual QString | log (const QString msg, const LogLevel level, char const *fileName, char const *methodName, int lineNumber, const QObject *sender=nullptr)=0 |
Log a message: If the logger is allowed to write on standard output, it will display the message (and timestamp) on the standard output If the logger is allowed to write on a file, it will also display the message in the log file. More... | |
virtual void | setDebugInformation (bool)=0 |
Allows the logger to add debug information to the log message. More... | |
virtual bool | setLogFileDirectory (QDir directoryName, bool moveExistingLogFile=true)=0 |
Set the specific directory to write to (default is the subdirectory "CamiTK" in the system temporary directory). More... | |
virtual void | setLogLevel (LogLevel level)=0 |
Sets Current verbosity level of the log. More... | |
virtual bool | setLogToFile (bool writeToFile)=0 |
Ask the logger to write to the log file. More... | |
virtual void | setLogToStandardOutput (bool writeToStdOut)=0 |
Allows the logger to write on std::cout. More... | |
virtual void | setMessageBoxLevel (LogLevel level)=0 |
Set the lowest log level that will open modal message box for messages instead of (silently/undisruptedly) write on std output. More... | |
virtual void | setTimeStampInformation (bool showTimeStamp)=0 |
By default a logger should always show the time-stamp in the form of "yyyy-MM-dd HH:mm:ss.zzz" In test environment, reproducible log message might be prefered. More... | |
virtual | ~InterfaceLogger ()=default |
empty virtual destructor, to avoid memory leak More... | |
The CamiTK logger interface provides a flexible tracing system to CamiTK applications.
Messages can logged on the standard output or on a file (or both) and can also show QMessageBox dialog.
CamiTK Logger Interface defines the API for all logger used by CamiTK applications.
For more information about how to use log
: how chatty should the log output be...
|
virtualdefault |
empty virtual destructor, to avoid memory leak
|
pure virtual |
Implemented in camitk::CamiTKLogger.
|
pure virtual |
Implemented in camitk::CamiTKLogger.
|
pure virtual |
Get the current verbosity level of the log.
Implemented in camitk::CamiTKLogger.
|
pure virtual |
check if the logger is currently writing on a file
Implemented in camitk::CamiTKLogger.
|
pure virtual |
check if the logger is currently writing on standard output (std::cout)
Implemented in camitk::CamiTKLogger.
|
pure virtual |
Implemented in camitk::CamiTKLogger.
|
pure virtual |
Implemented in camitk::CamiTKLogger.
|
pure virtual |
Log a message: If the logger is allowed to write on standard output, it will display the message (and timestamp) on the standard output If the logger is allowed to write on a file, it will also display the message in the log file.
The level parameter gives the current message level that has to be compared with the logger level: if this level is greater or equals to the current log level, the current message will be logged.
Example: if the logger level is at WARNING, only ERROR and WARNING level messages will be displayed.
If in a static method or a non QObject class, then call this method with an empty last parameter.
Implemented in camitk::CamiTKLogger.
|
pure virtual |
Allows the logger to add debug information to the log message.
Debug information contains the filename, line number and method names where the log was called. Note that the exact content of the method name debug information depends on the compiler.
Implemented in camitk::CamiTKLogger.
Referenced by main().
|
pure virtual |
Set the specific directory to write to (default is the subdirectory "CamiTK" in the system temporary directory).
If the log directory is different than the existing one:
directoryName | the new directory to use for the log file |
moveExistingLogFile | if true, the existing log file is move to the new directory and use to append the log messages from now. |
Implemented in camitk::CamiTKLogger.
Referenced by main().
|
pure virtual |
Sets Current verbosity level of the log.
Implemented in camitk::CamiTKLogger.
Referenced by main().
|
pure virtual |
Ask the logger to write to the log file.
By default, the directory to write to is the subdirectory "CamiTK" in the system temporary directory. The file name itself will be determined by the logger.
Implemented in camitk::CamiTKLogger.
Referenced by main().
|
pure virtual |
Allows the logger to write on std::cout.
Implemented in camitk::CamiTKLogger.
|
pure virtual |
Set the lowest log level that will open modal message box for messages instead of (silently/undisruptedly) write on std output.
Implemented in camitk::CamiTKLogger.
Referenced by main().
|
pure virtual |
By default a logger should always show the time-stamp in the form of "yyyy-MM-dd HH:mm:ss.zzz" In test environment, reproducible log message might be prefered.
In this case the time stamp can be disabled.
showTimeStamp | if false the time stamp is not printed in log message. |
Implemented in camitk::CamiTKLogger.
Referenced by main().