Qore Logger Module Reference  0.1
Logger::LoggerLevel Class Reference

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

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 OFF = MAXINT
 built-in logger levels
 

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

◆ getNextLowerLevel()

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

Returns closest lower logger level.

Parameters

◆ 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