BambooIsland: C:/Users/easterbunny/Desktop/Echtzeitgraphik-LU/trunk/src/Logger.h Source File

BambooIsland Abgabe 2

- Main Page
- Related Pages
- Classes
- Files

- File List

# C:/Users/easterbunny/Desktop/Echtzeitgraphik-LU/trunk/src/Logger.h

    00001 /*
    00002  * header file for Logger class
    00003  * written by: christian moellinger <ch.moellinger@gmail.com>
    00004  * 10/2010
    00005  */
    00006
    00007 #pragma once
    00008
    00009 #ifndef __realtime_lu_logger
    00010 #define __realtime_lu_logger
    00011
    00012 #include <string>
    00013 #include <fstream>
    00014
    00015 #ifdef TRACE
    00016 #warning TRACE was defined as precompiler variable by a used library. To prevent incompatibilities with the class Logger, TRACE was undefined!
    00017 #undef TRACE
    00018 #endif
    00019
    00020 #ifdef DEBUG
    00021 #warning DEBUG was defined as precompiler variable by a used library. To prevent incompatibilities with the class Logger, DEBUG was undefined!
    00022 #undef DEBUG
    00023 #endif
    00024
    00025 #ifdef WARN
    00026 #warning WARN was defined as precompiler variable by a used library. To prevent incompatibilities with the class Logger, WARN was undefined!
    00027 #undef WARN
    00028 #endif
    00029
    00030 #ifdef ERROR
    00031 #warning ERROR was defined as precompiler variable by a used library. To prevent incompatibilities with the class Logger, ERROR was undefined!
    00032 #undef ERROR
    00033 #endif
    00034
    00035 #ifdef FATAL
    00036 #warning FATAL was defined as precompiler variable by a used library. To prevent incompatibilities with the class Logger, FATAL was undefined!
    00037 #undef FATAL
    00038 #endif
    00039
    00040 #ifdef NOTHING
    00041 #warning NOTHING was defined as precompiler variable by a used library. To prevent incompatibilities with the class Logger, NOTHING was undefined!
    00042 #undef NOTHING
    00043 #endif
    00044
    00045 class Logger
    00046 {
    00047 public:
    00048     enum LogLevel
    00049     {
    00050         TRACE=0,
    00051         DEBUG,
    00052         WARN,
    00053         ERROR,
    00054         FATAL,
    00055         NOTHING
    00056     };
    00057
    00059     void setLogLevelForFile(LogLevel loglevel);
    00060
    00062     void setLogLevelForConsole(LogLevel loglevel);
    00063
    00065     void log(LogLevel level, const std::string message);
    00066
    00068     void log(LogLevel level, const char *message);
    00069
    00071     static Logger* instance();
    00072
    00073
    00074 private:
    00076     Logger();
    00077
    00078     ~Logger();
    00079
    00080     LogLevel loglevel_file;
    00081     LogLevel loglevel_console;
    00082
    00083     std::fstream logfile;
    00084
    00086     const char * getLevelName(LogLevel level);
    00087 };
    00088
    00089
    00090 #endif

All Classes Functions Variables Enumerations Enumerator