00001 #ifndef HEADER_LOG_H
00002 #define HEADER_LOG_H
00003
00004 #include "ExInfo.h"
00005
00006
00007
00008
00009 class Log {
00010 private:
00011 static int ms_logLevel;
00012 public:
00013
00014
00015
00016 static const int LEVEL_DEBUG = 7;
00017 static const int LEVEL_INFO = 6;
00018 static const int LEVEL_WARNING = 4;
00019 static const int LEVEL_ERROR = 3;
00020
00021 public:
00022 static void setLogLevel(int logLevel) { ms_logLevel = logLevel; }
00023 static int getLogLevel() { return ms_logLevel; }
00024
00025 static void log(int level, const char *file, int line,
00026 const ExInfo &info) throw();
00027 };
00028
00029 #define LOG_DEBUG(info) do { Log::log(Log::LEVEL_DEBUG, __FILE__, __LINE__, info); } while (false)
00030 #define LOG_INFO(info) do { Log::log(Log::LEVEL_INFO, __FILE__, __LINE__, info); } while (false)
00031 #define LOG_WARNING(info) do { Log::log(Log::LEVEL_WARNING, __FILE__, __LINE__, info); } while (false)
00032 #define LOG_ERROR(info) do { Log::log(Log::LEVEL_ERROR, __FILE__, __LINE__, info); } while (false)
00033
00034 #endif