![]() |
Computer Assited Medical Intervention Tool Kit
|
This class is a log utility. More...
#include <Log.h>
Static Public Member Functions | |
static void | closeLogFile () |
Method used to close the log File. | |
static std::ostream * | getLogStream () |
get the logFile (singleton) | |
static bool | getShowTime () |
get show time information | |
static bool | getShowUser () |
get the status of show user information | |
static std::string | getUserInformation () |
get the user information | |
static void | openLogFile () |
Method used to open the log File. | |
static void | showTime (bool) |
show date/time information in logs | |
static void | showUser (bool) |
show or not the user information |
Static Private Attributes | |
static std::ofstream * | logFilePtr = NULL |
the log file | |
static bool | showTimeInfo = false |
show time info | |
static bool | showUserInfo = false |
show user info |
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 macro CAMITK_INFO is always enabled.
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 |
0 | CAMITK_ERROR |
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 camitk::logFile, and 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 camitk::logFile, and 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().