Computer Assited Medical Intervention Tool Kit  version 3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Static Public Member Functions | Static Private Attributes | List of all members
camitk::Log Class Reference

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
 the log file More...
 
static bool showTimeInfo
 show time info More...
 
static bool showUserInfo
 show user info More...
 

Detailed Description

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_LEVELEnabled macros
0CAMITK_ERROR
1CAMITK_ERROR / CAMITK_WARNING
2CAMITK_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:

Member Function Documentation

static void camitk::Log::closeLogFile ( )
static

Method used to close the log File.

static std::ostream* camitk::Log::getLogStream ( )
static

get the logFile (singleton)

Returns
the currently opened ofstream or cout if the log file has not yet be opened
static bool camitk::Log::getShowTime ( )
static

get show time information

static bool camitk::Log::getShowUser ( )
static

get the status of show user information

static std::string camitk::Log::getUserInformation ( )
static

get the user information

static void camitk::Log::openLogFile ( )
static

Method used to open the log File.

static void camitk::Log::showTime ( bool  )
static

show date/time information in logs

static void camitk::Log::showUser ( bool  )
static

show or not the user information

Member Data Documentation

std::ofstream* camitk::Log::logFilePtr
staticprivate

the log file

bool camitk::Log::showTimeInfo
staticprivate

show time info

bool camitk::Log::showUserInfo
staticprivate

show user info


The documentation for this class was generated from the following file: