00001 // Module: Log4CPLUS 00002 // File: loglevel.h 00003 // Created: 6/2001 00004 // Author: Tad E. Smith 00005 // 00006 // 00007 // Copyright (C) Tad E. Smith All rights reserved. 00008 // 00009 // This software is published under the terms of the Apache Software 00010 // License version 1.1, a copy of which has been included with this 00011 // distribution in the LICENSE.APL file. 00012 // 00013 00018 #ifndef LOG4CPLUS_LOGLEVEL_HEADER_ 00019 #define LOG4CPLUS_LOGLEVEL_HEADER_ 00020 00021 #include <log4cplus/config.h> 00022 #include <log4cplus/streams.h> 00023 #include <log4cplus/tstring.h> 00024 00025 #include <vector> 00026 00027 namespace log4cplus { 00028 00036 typedef int LogLevel; 00037 00041 const LogLevel OFF_LOG_LEVEL = 60000; 00042 00046 const LogLevel FATAL_LOG_LEVEL = 50000; 00047 00051 const LogLevel ERROR_LOG_LEVEL = 40000; 00052 00056 const LogLevel WARN_LOG_LEVEL = 30000; 00057 00062 const LogLevel INFO_LOG_LEVEL = 20000; 00063 00067 const LogLevel DEBUG_LOG_LEVEL = 10000; 00068 00072 const LogLevel TRACE_LOG_LEVEL = 0; 00073 00077 const LogLevel ALL_LOG_LEVEL = TRACE_LOG_LEVEL; 00078 00083 const LogLevel NOT_SET_LOG_LEVEL = -1; 00084 00085 00092 typedef log4cplus::tstring (*LogLevelToStringMethod)(LogLevel); 00093 00100 typedef LogLevel (*StringToLogLevelMethod)(const log4cplus::tstring&); 00101 00102 00103 00117 class LOG4CPLUS_EXPORT LogLevelManager { 00118 public: 00119 LogLevelManager(); 00120 ~LogLevelManager(); 00121 00129 log4cplus::tstring toString(LogLevel ll) const; 00130 00138 LogLevel fromString(const log4cplus::tstring& s) const; 00139 00147 void pushToStringMethod(LogLevelToStringMethod newToString); 00148 00156 void pushFromStringMethod(StringToLogLevelMethod newFromString); 00157 00158 private: 00159 // Data 00160 void* toStringMethods; 00161 void* fromStringMethods; 00162 00163 // Disable Copy 00164 LogLevelManager(const LogLevelManager&); 00165 LogLevelManager& operator=(const LogLevelManager&); 00166 }; 00167 00171 LOG4CPLUS_EXPORT LogLevelManager& getLogLevelManager(); 00172 00173 } 00174 00175 00176 #endif // LOG4CPLUS_LOGLEVEL_HEADER_ 00177