18 #ifndef _LOG4CXX_LEVEL_H 19 #define _LOG4CXX_LEVEL_H 22 #include <log4cxx/logstring.h> 24 #include <log4cxx/helpers/objectimpl.h> 25 #include <log4cxx/helpers/objectptr.h> 28 #pragma warning ( push ) 29 #pragma warning ( disable: 4251 ) 61 virtual LogString getName()
const 63 return LOG4CXX_STR(
"Level");
66 virtual LevelPtr toLevel(
const LogString& sArg)
const 71 virtual LevelPtr toLevel(
int val)
const 78 BEGIN_LOG4CXX_CAST_MAP()
79 LOG4CXX_CAST_ENTRY(
Level)
80 END_LOG4CXX_CAST_MAP()
86 const LogString& name,
87 int syslogEquivalent);
94 static LevelPtr toLevel(
const std::string& sArg);
103 static LevelPtr toLevel(
const std::string& sArg,
104 const LevelPtr& defaultLevel);
109 void toString(std::string& name)
const;
111 #if LOG4CXX_WCHAR_T_API 117 static LevelPtr toLevel(
const std::wstring& sArg);
126 static LevelPtr toLevel(
const std::wstring& sArg,
127 const LevelPtr& defaultLevel);
132 void toString(std::wstring& name)
const;
134 #if LOG4CXX_UNICHAR_API 140 static LevelPtr toLevel(
const std::basic_string<UniChar>& sArg);
149 static LevelPtr toLevel(
const std::basic_string<UniChar>& sArg,
150 const LevelPtr& defaultLevel);
155 void toString(std::basic_string<UniChar>& name)
const;
157 #if LOG4CXX_CFSTRING_API 163 static LevelPtr toLevel(
const CFStringRef& sArg);
172 static LevelPtr toLevel(
const CFStringRef& sArg,
173 const LevelPtr& defaultLevel);
178 void toString(CFStringRef& name)
const;
185 static LevelPtr toLevelLS(
const LogString& sArg);
194 static LevelPtr toLevelLS(
const LogString& sArg,
195 const LevelPtr& defaultLevel);
200 LogString toString()
const;
206 static LevelPtr toLevel(
int val);
212 static LevelPtr toLevel(
int val,
const LevelPtr& defaultLevel);
227 static LevelPtr getAll();
228 static LevelPtr getFatal();
229 static LevelPtr getError();
230 static LevelPtr getWarn();
231 static LevelPtr getInfo();
232 static LevelPtr getDebug();
233 static LevelPtr getTrace();
234 static LevelPtr getOff();
240 virtual bool equals(
const LevelPtr& level)
const;
242 inline bool operator==(
const Level& level1)
const 244 return (this->level == level1.level);
247 inline bool operator!=(
const Level& level1)
const 249 return (this->level != level1.level);
257 return syslogEquivalent;
270 virtual bool isGreaterOrEqual(
const LevelPtr& level)
const;
284 int syslogEquivalent;
299 template<>
inline bool LevelPtr::operator==(
const LevelPtr& rhs)
const 301 return (*this)->equals(rhs);
303 template<>
inline bool LevelPtr::operator!=(
const LevelPtr& rhs)
const 305 return !(*
this == rhs);
307 #if defined(_MSC_VER) && !defined(LOG4CXX_STATIC) && defined(LOG4CXX) 309 #elif defined(_MSC_VER) && !defined(LOG4CXX_STATIC) 310 #pragma warning(push) 311 #pragma warning(disable: 4231) 312 extern template class LOG4CXX_EXPORT log4cxx::helpers::ObjectPtrT<Level>;
320 #define DECLARE_LOG4CXX_LEVEL(level)\ 322 class Class##level : public Level::LevelClass\ 325 Class##level() : Level::LevelClass() {}\ 326 virtual LogString getName() const { return LOG4CXX_STR(#level); } \ 327 virtual LevelPtr toLevel(const LogString& sArg) const\ 328 { return level::toLevelLS(sArg); }\ 329 virtual LevelPtr toLevel(int val) const\ 330 { return level::toLevel(val); }\ 332 DECLARE_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(level, Class##level) 334 #define IMPLEMENT_LOG4CXX_LEVEL(level) \ 335 IMPLEMENT_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(level, Class##level) 337 #if defined(_MSC_VER) 338 #pragma warning (pop) 341 #endif //_LOG4CXX_LEVEL_H static LevelPtr toLevel(const std::string &sArg)
Convert the string passed as argument to a level.
static LevelPtr toLevelLS(const LogString &sArg)
Convert the string passed as argument to a level.
Implementation class for Object.
Definition: objectimpl.h:28
int getSyslogEquivalent() const
Return the syslog equivalent of this level as an integer.
Definition: level.h:255
int toInt() const
Returns the integer representation of this level.
Definition: level.h:276
Defines the minimum set of levels recognized by the system, that is OFF, FATAL, ERROR, WARN, INFO, DEBUG and ALL.
Definition: level.h:53
Definition: appender.h:33