- Main Page
- Classes
- Files

- File List

# Logger.h

    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
    00013 class Logger
    00014 {
    00015 public:
    00016     enum LogLevel
    00017     {
    00018         Trace=0,
    00019         Debug,
    00020         Warn,
    00021         Error,
    00022         Fatal,
    00023         Nothing
    00024     };
    00025
    00027     void setLogLevelForFile(LogLevel loglevel);
    00028
    00030     void setLogLevelForConsole(LogLevel loglevel);
    00031
    00033     void log(LogLevel level, const std::string message);
    00034
    00036     void log(LogLevel level, const char *message);
    00037
    00039     static Logger* instance();
    00040
    00041     Logger();
    00042     ~Logger();
    00043 private:
    00044     LogLevel loglevel_file;
    00045     LogLevel loglevel_console;
    00046
    00047     std::fstream logfile;
    00048
    00050     const char * getLevelName(LogLevel level);
    00051 };
    00052
    00053
    00054 #endif