Level Class Reference

Defines the minimum set of levels recognized by the system, that is `OFF`, `FATAL`, `ERROR`, `WARN`, `INFO`, `DEBUG` and `ALL`. More...

Inheritance diagram for Level:

## Classes

class | LevelClass

## Public Types

enum | { OFF_INT = INT_MAX, FATAL_INT = 50000, ERROR_INT = 40000, WARN_INT = 30000, INFO_INT = 20000, DEBUG_INT = 10000, TRACE_INT = 5000, ALL_INT = INT_MIN }

## Public Member Functions

| Level (int level, const LogString &name, int syslogEquivalent)
| Instantiate a Level object. More...
void | toString (std::string &name) const
| Get the name of the level in the current encoding. More...
void | toString (std::wstring &name) const
| Get the name of the level. More...
void | toString (std::basic_string< UniChar > &name) const
| Get the name of the level. More...
void | toString (CFStringRef &name) const
| Get the name of the level. More...
LogString | toString () const
| Returns the string representation of this level. More...
virtual bool | equals (const LevelPtr &level) const
| Two levels are equal if their level fields are equal. More...
bool | operator== (const Level &level1) const
bool | operator!= (const Level &level1) const
int | getSyslogEquivalent () const
| Return the syslog equivalent of this level as an integer. More...
virtual bool | isGreaterOrEqual (const LevelPtr &level) const
| Returns `true` if this level has a higher or equal level than the level passed as argument, `false` otherwise. More...
int | toInt () const
| Returns the integer representation of this level. More...
Public Member Functions inherited from ObjectImpl
| ObjectImpl ()
virtual | ~ObjectImpl ()
void | addRef () const
void | releaseRef () const
Public Member Functions inherited from Object
virtual const helpers::Class & | getClass () const
virtual | ~Object ()
virtual bool | instanceof (const Class &clazz) const =0
virtual const void * | cast (const Class &clazz) const =0

## Static Public Member Functions

static LevelPtr | toLevel (const std::string &sArg)
| Convert the string passed as argument to a level. More...
static LevelPtr | toLevel (const std::string &sArg, const LevelPtr &defaultLevel)
| Convert the string passed as argument to a level. More...
static LevelPtr | toLevel (const std::wstring &sArg)
| Convert the string passed as argument to a level. More...
static LevelPtr | toLevel (const std::wstring &sArg, const LevelPtr &defaultLevel)
| Convert the string passed as argument to a level. More...
static LevelPtr | toLevel (const std::basic_string< UniChar > &sArg)
| Convert the string passed as argument to a level. More...
static LevelPtr | toLevel (const std::basic_string< UniChar > &sArg, const LevelPtr &defaultLevel)
| Convert the string passed as argument to a level. More...
static LevelPtr | toLevel (const CFStringRef &sArg)
| Convert the string passed as argument to a level. More...
static LevelPtr | toLevel (const CFStringRef &sArg, const LevelPtr &defaultLevel)
| Convert the string passed as argument to a level. More...
static LevelPtr | toLevelLS (const LogString &sArg)
| Convert the string passed as argument to a level. More...
static LevelPtr | toLevelLS (const LogString &sArg, const LevelPtr &defaultLevel)
| Convert the string passed as argument to a level. More...
static LevelPtr | toLevel (int val)
| Convert an integer passed as argument to a level. More...
static LevelPtr | toLevel (int val, const LevelPtr &defaultLevel)
| Convert an integer passed as argument to a level. More...
static LevelPtr | getAll ()
static LevelPtr | getFatal ()
static LevelPtr | getError ()
static LevelPtr | getWarn ()
static LevelPtr | getInfo ()
static LevelPtr | getDebug ()
static LevelPtr | getTrace ()
static LevelPtr | getOff ()
Static Public Member Functions inherited from Object
static const helpers::Class & | getStaticClass ()
static const log4cxx::helpers::ClassRegistration & | registerClass ()

## Additional Inherited Members

Protected Attributes inherited from ObjectImpl
unsigned int volatile | ref

## Detailed Description

Defines the minimum set of levels recognized by the system, that is `OFF`, `FATAL`, `ERROR`, `WARN`, `INFO`, `DEBUG` and `ALL`.

The `Level` class may be subclassed to define a larger level set.

## Member Enumeration Documentation

## anonymous enum

anonymous enum

Enumerator
OFF_INT |
FATAL_INT |
ERROR_INT |
WARN_INT |
INFO_INT |
DEBUG_INT |
TRACE_INT |
ALL_INT |

## Constructor & Destructor Documentation

## Level()

Level | ( | int | level,
|  | const LogString & | name,
|  | int | syslogEquivalent
| ) |  |

Instantiate a Level object.

## Member Function Documentation

## equals()

virtual bool equals | ( | const LevelPtr & | level | ) | const

virtual

Two levels are equal if their level fields are equal.

## getAll()

static LevelPtr getAll | ( |  | ) |

static

## getDebug()

static LevelPtr getDebug | ( |  | ) |

static

## getError()

static LevelPtr getError | ( |  | ) |

static

## getFatal()

static LevelPtr getFatal | ( |  | ) |

static

## getInfo()

static LevelPtr getInfo | ( |  | ) |

static

## getOff()

static LevelPtr getOff | ( |  | ) |

static

## getSyslogEquivalent()

int getSyslogEquivalent | ( |  | ) | const

inline

Return the syslog equivalent of this level as an integer.

## getTrace()

static LevelPtr getTrace | ( |  | ) |

static

## getWarn()

static LevelPtr getWarn | ( |  | ) |

static

## isGreaterOrEqual()

virtual bool isGreaterOrEqual | ( | const LevelPtr & | level | ) | const

virtual

Returns `true` if this level has a higher or equal level than the level passed as argument, `false` otherwise.

You should think twice before overriding the default implementation of `isGreaterOrEqual` method.

## operator!=()

bool operator!= | ( | const Level & | level1 | ) | const

inline

## operator==()

bool operator== | ( | const Level & | level1 | ) | const

inline

## toInt()

int toInt | ( |  | ) | const

inline

Returns the integer representation of this level.

## toLevel() [1/10]

static LevelPtr toLevel | ( | const std::string & | sArg | ) |

static

Convert the string passed as argument to a level.

If the conversion fails, then this method returns DEBUG.

Parameters

  sArg | level name.

## toLevel() [2/10]

static LevelPtr toLevel | ( | const std::string & | sArg,
|  | const LevelPtr & | defaultLevel
| ) |  |

static

Convert the string passed as argument to a level.

If the conversion fails, then this method returns the value of `defaultLevel`.

Parameters

  sArg | level name.
  defaultLevel | level to return if no match.

Returns

## toLevel() [3/10]

static LevelPtr toLevel | ( | const std::wstring & | sArg | ) |

static

Convert the string passed as argument to a level.

If the conversion fails, then this method returns DEBUG.

Parameters

  sArg | level name.

## toLevel() [4/10]

static LevelPtr toLevel | ( | const std::wstring & | sArg,
|  | const LevelPtr & | defaultLevel
| ) |  |

static

Convert the string passed as argument to a level.

If the conversion fails, then this method returns the value of `defaultLevel`.

Parameters

  sArg | level name.
  defaultLevel | level to return if no match.

Returns

## toLevel() [5/10]

static LevelPtr toLevel | ( | const std::basic_string< UniChar > & | sArg | ) |

static

Convert the string passed as argument to a level.

If the conversion fails, then this method returns DEBUG.

Parameters

  sArg | level name.

## toLevel() [6/10]

static LevelPtr toLevel | ( | const std::basic_string< UniChar > & | sArg,
|  | const LevelPtr & | defaultLevel
| ) |  |

static

Convert the string passed as argument to a level.

If the conversion fails, then this method returns the value of `defaultLevel`.

Parameters

  sArg | level name.
  defaultLevel | level to return if no match.

Returns

## toLevel() [7/10]

static LevelPtr toLevel | ( | const CFStringRef & | sArg | ) |

static

Convert the string passed as argument to a level.

If the conversion fails, then this method returns DEBUG.

Parameters

  sArg | level name.

## toLevel() [8/10]

static LevelPtr toLevel | ( | const CFStringRef & | sArg,
|  | const LevelPtr & | defaultLevel
| ) |  |

static

Convert the string passed as argument to a level.

If the conversion fails, then this method returns the value of `defaultLevel`.

Parameters

  sArg | level name.
  defaultLevel | level to return if no match.

Returns

## toLevel() [9/10]

static LevelPtr toLevel | ( | int | val | ) |

static

Convert an integer passed as argument to a level.

If the conversion fails, then this method returns DEBUG.

## toLevel() [10/10]

static LevelPtr toLevel | ( | int | val,
|  | const LevelPtr & | defaultLevel
| ) |  |

static

Convert an integer passed as argument to a level.

If the conversion fails, then this method returns the specified default.

## toLevelLS() [1/2]

static LevelPtr toLevelLS | ( | const LogString & | sArg | ) |

static

Convert the string passed as argument to a level.

If the conversion fails, then this method returns DEBUG.

Parameters

  sArg | level name.

## toLevelLS() [2/2]

static LevelPtr toLevelLS | ( | const LogString & | sArg,
|  | const LevelPtr & | defaultLevel
| ) |  |

static

Convert the string passed as argument to a level.

If the conversion fails, then this method returns the value of `defaultLevel`.

Parameters

  sArg | level name.
  defaultLevel | level to return if no match.

Returns

## toString() [1/5]

void toString | ( | std::string & | name | ) | const

Get the name of the level in the current encoding.

Parameters

  name | buffer to which name is appended.

## toString() [2/5]

void toString | ( | std::wstring & | name | ) | const

Get the name of the level.

Parameters

  name | buffer to which name is appended.

## toString() [3/5]

void toString | ( | std::basic_string< UniChar > & | name | ) | const

Get the name of the level.

Parameters

  name | buffer to which name is appended.

## toString() [4/5]

void toString | ( | CFStringRef & | name | ) | const

Get the name of the level.

Parameters

  name | buffer to which name is appended.

## toString() [5/5]

LogString toString | ( |  | ) | const

Returns the string representation of this level.

Returns
  level name.

The documentation for this class was generated from the following file:

- level.h