Flow Visualization 1.0
|
00001 /* 00002 * header file for Logger class 00003 * written by: christian moellinger <ch.moellinger@gmail.com> 00004 * 10/2010 00005 */ 00006 00007 #ifndef __realtime_lu_logger 00008 #define __realtime_lu_logger 00009 00010 #include <string> 00011 #include <fstream> 00012 00014 class Logger 00015 { 00016 public: 00017 enum LogLevel 00018 { 00019 Trace=0, 00020 Debug, 00021 Warn, 00022 Error, 00023 Fatal, 00024 Nothing 00025 }; 00026 00028 void setLogLevelForFile(LogLevel loglevel); 00029 00031 void setLogLevelForConsole(LogLevel loglevel); 00032 00034 void log(LogLevel level, const std::string message); 00035 00037 void log(LogLevel level, const char *message); 00038 00040 static Logger* instance(); 00041 00042 Logger(); 00043 ~Logger(); 00044 private: 00045 LogLevel loglevel_file; 00046 LogLevel loglevel_console; 00047 00048 std::fstream logfile; 00049 00051 const char * getLevelName(LogLevel level); 00052 }; 00053 00054 00055 #endif