Add a proper logger for CamiTK applications
Steps to finish (refer to internal specification doc)
move new macros (currently in
Log.hinclude Application.h, InterfaceLogger.h, and the macros
nullptrin macros and tab to space
static void setLogger(InterfaceLogger * logger)protected
static InterfaceLogger * getLogger();
can we move
applicationLoggerto a static field of
getLogger()to implement proper singleton. Use case to consider: an Application class deriving from camitk::Application does not want to use a CamiTKLogger instance but another type of logger. Will this strategy work. Ex: CamiTKSM constructor instanciate FooLogger and wants applicationLogger to reference this instanciate.
CAMITK_STATIC_*macro or find another more simple way of taking into account loggin in
log file directory should be defined by default and should be a tmp directory. There should a way to get the name of this directory in the GUI
CamiTKLogger::writeToFileshould be true by default. Log file directory should be defined by default.
CamiTKLoggerhas a new QFile field and a
describe how CamiTKLogger works in api doc
QMutex mutex;in CamiTKLogger a good idea/practice?
log("Ahrrrrggghhhh.... Log Writer is being destructed !!! See you soon CamiTK !!! (now, closing files properly...)", InterfaceLogger::TRACE, NULL);in
~CamiTKLoggeris called or not
check if there is another solution than to have the log file constantly opened (might be a problem if application crash, the file might be destroyed/in a bad state). Check
flush()is safe enough. Do not open/close file all the time
LoggerSettinguse application settings file to save message box level, log level, log file directory, write to standard out,
InterfaceLogger API →
setWriteToFile(bool)(= test if directory is writable)
Add debug functionality using
__FILE__(through an encapsulated
setLogFileDirectory: add boolean, true by default. If true, move the previous log file to the new directory without changing its name and append to it
add boolean flag to enable/disable the timestamp
add CAMITK_DISABLE_LOG option (it should not be NDEBUG, as log should also be available for "Release"
have the console at the bottom of the main window + show/hide in the status bar + icon to show number of error/warning/info/trace like in atom editor
write test code for logger / verbosity level
Write a test application to unit test CamiTKLogger