Qore Logger Module Reference 0.6
Loading...
Searching...
No Matches
Logger::LoggerLevel Class Reference

Defines the minimum set of levels recognized by the system. More...

#include <Logger.qm.dox.h>

Inheritance diagram for Logger::LoggerLevel:
[legend]

Public Member Methods

 constructor (int code, string str)
 Creates a new object. More...
 
string getStr ()
 Gets level string.
 
int getValue ()
 Gets level code value.
 
bool isEqual (LoggerLevel other)
 Compares two logger levels. More...
 
bool isGreaterOrEqual (LoggerLevel other)
 Compares logger levels. More...
 

Static Public Member Methods

static LoggerLevel getLevel (int level, *LoggerLevel default_level)
 Converts the input argument to a level. More...
 
static LoggerLevel getLevel (string level_str, *LoggerLevel default_level)
 Converts the input argument to a level. More...
 
static LoggerLevel getLevelAll ()
 Returns an ALL Level.
 
static LoggerLevel getLevelDebug ()
 Returns a DEBUG Level.
 
static LoggerLevel getLevelError ()
 Returns an ERROR Level.
 
static LoggerLevel getLevelFatal ()
 Returns a FATAL Level.
 
static LoggerLevel getLevelInfo ()
 Returns an INFO Level.
 
static LoggerLevel getLevelOff ()
 Returns an OFF Level.
 
static LoggerLevel getLevelTrace ()
 Returns a TRACE Level.
 
static LoggerLevel getLevelWarn ()
 Returns a WARN Level.
 
static *LoggerLevel getNextHigherLevel (int level)
 Returns closest higher logger level. More...
 
static *LoggerLevel getNextLowerLevel (int level)
 Returns closest lower logger level. More...
 

Public Attributes

const ALL = MININT
 The lowest logger level.
 
const DEBUG = 10000
 Logger level for debugging messages.
 
const ERROR = 40000
 Logger level for (non-fatal) errors.
 
const FATAL = 50000
 Logger level for fatal errors.
 
const INFO = 20000
 Logger level for informational messages.
 
const OFF = MAXINT
 The highest logger level.
 
const TRACE = 5000
 Logger level for trace messages.
 
const WARN = 30000
 Logger level for warnings.
 

Private:Internal Attributes

const LEVEL_TO_LEVEL_STR = map {$1.value: $1.key}
 Int to string hash.
 
int levelCode
 Integer level value.
 
string levelStr
 String representation of the level.
 
const LEVELSTR_TO_LEVEL
 String to int hash.
 

Static Private:Internal Attributes

static hash< string, LoggerLevellevelMap
 Contains a list of instantiated levels.
 

Detailed Description

Defines the minimum set of levels recognized by the system.

The set of built-in levels includes TRACE, DEBUG, INFO, WARN, ERROR and FATAL. Log4q also supports custom log levels where the LoggerLevel class may be subclassed to define a larger level set.

Member Function Documentation

◆ constructor()

Logger::LoggerLevel::constructor ( int  code,
string  str 
)

Creates a new object.

Parameters
codeinteger value
strstring representation

◆ getLevel() [1/2]

static LoggerLevel Logger::LoggerLevel::getLevel ( int  level,
*LoggerLevel  default_level 
)
static

Converts the input argument to a level.

Return value is either instantiated or used the existing one if there is any.

Parameters
levelthe input level
default_levelvalue to return if conversion is not possible.
Exceptions
LOGGER-ERRORif defaultLevel is nothing and level not found

◆ getLevel() [2/2]

static LoggerLevel Logger::LoggerLevel::getLevel ( string  level_str,
*LoggerLevel  default_level 
)
static

Converts the input argument to a level.

Return value is either instantiated or used the existing one if there is any.

Parameters
level_strthe string input level
default_levelvalue to return if conversion is not possible.
Exceptions
LOGGER-ERRORif default_level is nothing and level_str not found

◆ getNextHigherLevel()

static *LoggerLevel Logger::LoggerLevel::getNextHigherLevel ( int  level)
static

Returns closest higher logger level.

Parameters
levelthe logger level
Returns
Loggerlevel or NOTHING if there is no higher level
Exceptions
LOGGER-ERRORif level not found

◆ getNextLowerLevel()

static *LoggerLevel Logger::LoggerLevel::getNextLowerLevel ( int  level)
static

Returns closest lower logger level.

Parameters
levelthe logger level
Returns
Loggerlevel or NOTHING if there is no lower level
Exceptions
LOGGER-ERRORif level not found

◆ isEqual()

bool Logger::LoggerLevel::isEqual ( LoggerLevel  other)

Compares two logger levels.

Parameters
otherthe other level to compares

◆ isGreaterOrEqual()

bool Logger::LoggerLevel::isGreaterOrEqual ( LoggerLevel  other)

Compares logger levels.

Parameters
otherthe other level to compares
Returns
True if level is greater or equal to the other level