![]() |
Computer Assited Medical Intervention Tool Kit
version 4.0
|
This class is a log utility. More...
#include <Log.h>
Static Public Member Functions | |
static void | closeLogFile () |
Method used to close the log File. More... | |
static std::ostream * | getLogStream () |
get the logFile (singleton) More... | |
static bool | getShowTime () |
get show time information More... | |
static bool | getShowUser () |
get the status of show user information More... | |
static std::string | getUserInformation () |
get the user information More... | |
static void | openLogFile () |
Method used to open the log File. More... | |
static void | showTime (bool) |
show date/time information in logs More... | |
static void | showUser (bool) |
show or not the user information More... | |
Static Private Attributes | |
static std::ofstream * | logFilePtr = NULL |
the log file More... | |
static bool | showTimeInfo = false |
show time info More... | |
static bool | showUserInfo = false |
show user info More... | |
This class is a log utility.
It helps you to log messages anywhere in your code for different levels: CAMITK_INFO, CAMITK_ERROR, CAMITK_WARNING and CAMITK_DEBUG. Log macros CAMITK_INFO and CAMITK_ERROR are always enabled. Log macros CAMITK_WARNING and CAMITK_DEBUG are two optional macro, disabled by default.
Logs are defined by macros, which can be switch off at compile time. The log behaviour is defined directly by the value of 2 cmake variables: CAMITK_LOG_FILE and CAMITK_LOG_LEVEL.
For CAMITK_LOG_LEVEL consider the following table:
CAMITK_LOG_LEVEL | Enabled macros |
1 | CAMITK_ERROR / CAMITK_WARNING |
2 | CAMITK_ERROR / CAMITK_WARNING / CAMITK_DEBUG |
For CAMITK_LOG_FILE: You can choose to save logs into "log.txt" file in the executable directory. If this file does not exist, it is automatically created when the application is executed. This option is configured by cmake variable CAMITK_LOG_FILE.
How to use the macro in the source:
Example : CAMITK_INFO("class used", "method used", "message" << std::endl);
|
static |
Method used to close the log File.
References logFilePtr.
Referenced by camitk::Application::quitting().
|
static |
get the logFile (singleton)
References logFilePtr.
|
static |
get show time information
References showTimeInfo.
|
static |
get the status of show user information
References showUserInfo.
|
static |
get the user information
|
static |
Method used to open the log File.
References logFilePtr.
Referenced by camitk::Application::Application().
|
static |
show date/time information in logs
References showTimeInfo.
|
static |
show or not the user information
References showUserInfo.
|
staticprivate |
|
staticprivate |
show time info
Referenced by getShowTime(), and showTime().
|
staticprivate |
show user info
Referenced by getShowUser(), and showUser().