00001 // Module: Log4CPLUS 00002 // File: loglevel.h 00003 // Created: 6/2001 00004 // Author: Tad E. Smith 00005 // 00006 // 00007 // Copyright 2001-2009 Tad E. Smith 00008 // 00009 // Licensed under the Apache License, Version 2.0 (the "License"); 00010 // you may not use this file except in compliance with the License. 00011 // You may obtain a copy of the License at 00012 // 00013 // http://www.apache.org/licenses/LICENSE-2.0 00014 // 00015 // Unless required by applicable law or agreed to in writing, software 00016 // distributed under the License is distributed on an "AS IS" BASIS, 00017 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 // See the License for the specific language governing permissions and 00019 // limitations under the License. 00020 00025 #ifndef LOG4CPLUS_LOGLEVEL_HEADER_ 00026 #define LOG4CPLUS_LOGLEVEL_HEADER_ 00027 00028 #include "dcmtk/oflog/config.h" 00029 #include "dcmtk/oflog/streams.h" 00030 #include "dcmtk/oflog/tstring.h" 00031 00032 //#include <vector> 00033 00034 namespace log4cplus { 00035 00043 typedef int LogLevel; 00044 00048 const LogLevel OFF_LOG_LEVEL = 60000; 00049 00053 const LogLevel FATAL_LOG_LEVEL = 50000; 00054 00058 const LogLevel ERROR_LOG_LEVEL = 40000; 00059 00063 const LogLevel WARN_LOG_LEVEL = 30000; 00064 00069 const LogLevel INFO_LOG_LEVEL = 20000; 00070 00074 const LogLevel DEBUG_LOG_LEVEL = 10000; 00075 00079 const LogLevel TRACE_LOG_LEVEL = 0; 00080 00084 const LogLevel ALL_LOG_LEVEL = TRACE_LOG_LEVEL; 00085 00090 const LogLevel NOT_SET_LOG_LEVEL = -1; 00091 00092 00099 typedef log4cplus::tstring (*LogLevelToStringMethod)(LogLevel); 00100 00107 typedef LogLevel (*StringToLogLevelMethod)(const log4cplus::tstring&); 00108 00109 00110 00124 class LOG4CPLUS_EXPORT LogLevelManager { 00125 public: 00126 LogLevelManager(); 00127 ~LogLevelManager(); 00128 00136 log4cplus::tstring toString(LogLevel ll) const; 00137 00145 LogLevel fromString(const log4cplus::tstring& s) const; 00146 00154 void pushToStringMethod(LogLevelToStringMethod newToString); 00155 00163 void pushFromStringMethod(StringToLogLevelMethod newFromString); 00164 00165 private: 00166 // Data 00167 void* toStringMethods; 00168 void* fromStringMethods; 00169 00170 // Disable Copy 00171 LogLevelManager(const LogLevelManager&); 00172 LogLevelManager& operator=(const LogLevelManager&); 00173 }; 00174 00178 LOG4CPLUS_EXPORT LogLevelManager& getLogLevelManager(); 00179 00180 } 00181 00182 00183 #endif // LOG4CPLUS_LOGLEVEL_HEADER_ 00184