Computer Assited Medical Intervention Tool Kit
version 4.1
|
This class is a log utility. More...
#include <Log.h>
Static Public Member Functions | |
static QString | getLevelAsString (InterfaceLogger::LogLevel level) |
get the enum value as a text More... | |
static InterfaceLogger::LogLevel | getLevelFromString (QString levelString) |
get the enum value from the text More... | |
static InterfaceLogger * | getLogger () |
get the current application logger More... | |
static void | setLogger (InterfaceLogger *logger) |
set the application logger and delete the previous logger Call this method transfers the logger instance ownership to class Log. More... | |
Static Private Attributes | |
static InterfaceLogger * | applicationLogger = nullptr |
Global Logger manager. More... | |
This class is a log utility.
The aims of the log in CamiTK are:
There are four types of message (
These messages are written using the corresponding CAMITK log macros: CAMITK_ERROR, CAMITK_WARNING, CAMITK_INFO and CAMITK_TRACE.
For static methods and non QObject class, use the ALT CAMITK log macros: CAMITK_ERROR_ALT, CAMITK_WARNING_ALT, CAMITK_INFO_ALT and CAMITK_TRACE_ALT.
There are also specific IF CAMITK macros use to log only if a given boolean expression is true: CAMITK_ERROR_IF, CAMITK_WARNING_IF, CAMITK_INFO_IF and CAMITK_TRACE_IF.
And their corresponding counterparts for static methods or non QObject class: CAMITK_ERROR_IF_ALT, CAMITK_WARNING_IF_ALT, CAMITK_INFO_IF_ALT and CAMITK_TRACE_IF_ALT.
Depending on the current application logger log level, not all the messages are displayed.
A default logger is instanciated for all application using the CamiTKLogger class
The current log level can be set to
A message box level is also available: any message equals or above the message box level will be shown in a modal QMessageBox dialog.
Debug information are also available: it will automatically print the method name, class or file name and line where the log message originated. This is very useful during debug session.
Debug information are optional.
To log message, use the macro defined in this class header.
The log message time stamp can be turned on and off as well.
Some simple examples:
Available application property names linked to log settings:
|
static |
get the enum value as a text
References camitk::InterfaceLogger::ERROR, camitk::InterfaceLogger::INFO, camitk::InterfaceLogger::NONE, camitk::InterfaceLogger::TRACE, and camitk::InterfaceLogger::WARNING.
Referenced by camitk::CamiTKLogger::buildLogMessage(), camitk::Application::createProperties(), camitk::CamiTKLogger::log(), camitk::CamiTKLogger::setLogLevel(), and camitk::CamiTKLogger::setMessageBoxLevel().
|
static |
get the enum value from the text
References camitk::InterfaceLogger::ERROR, camitk::InterfaceLogger::INFO, camitk::InterfaceLogger::NONE, camitk::InterfaceLogger::TRACE, and camitk::InterfaceLogger::WARNING.
|
static |
get the current application logger
References applicationLogger.
Referenced by camitk::Application::applyPropertyValues(), camitk::Application::createProperties(), main(), and camitk::MainWindow::MainWindow().
|
static |
set the application logger and delete the previous logger Call this method transfers the logger instance ownership to class Log.
References applicationLogger.
|
staticprivate |
Global Logger manager.
Referenced by getLogger(), and setLogger().