Class comb.logging.Level
Level class used to describe logging levels. The levels determine what types of events are logged to the appenders for example the if Level.ALL is used then all event will be logged, however if Level.INFO was used then ONLY INFO, WARN, ERROR, and FATAL events will be logged. To turn off logging for a logger use Level.OFF.
Not typically instantiated directly, but through staticly defined levels
Defined in: level.js.
Class Detail
Field Detail
<static>
comb.logging.Level.ALL
Level to allow logging of all events.
<static>
comb.logging.Level.DEBUG
Logs only events debug or greater.
<static>
comb.logging.Level.ERROR
Error or fatal events
<static>
comb.logging.Level.FATAL
Only fatal events
<static>
comb.logging.Level.INFO
Only info, or error related events
{Number}
level
the numerical representation of this level.
{String}
name
the name of level.
<static>
comb.logging.Level.OFF
No events will be logged.
<static>
comb.logging.Level.TRACE
Like debug but provides a finer level of detail
<static>
comb.logging.Level.WARN
Only warn or error related events
Method Detail
<static>
{undefined|comb.logging.Level}
comb.logging.Level.addLevel(label, level)
Adds a new level to the Level object.
Example 1 :
logger = Logger.getLogger("my.logger");
//create the custom level
Level.addLevel("custom_Level", 20);
//now set the level on a logger
logger.level = Level.CUSTOM_LEVEL;
- Parameters:
- {string} label
- the label of the level, Note: the label will be coverted to uppercase.
- {number} level
- the level of the level
- Returns:
- {undefined|comb.logging.Level} the level that was created.
var ret;
if(base.isString(label) && base.isNumber(level)){
label = label.toUpperCase();
LEVELS_REVERSE[level] = label;
LEVELS[label] = level;
ret = (this[label] = new Level(level, label));
}
return ret;
{Boolean}
equals(level)
Determing if this level is equal to another level based off of the numerical rank.
- Parameters:
- {comb.logging.Level} level
- the level to compare
- Returns:
- {Boolean} true if this is equal to that false otherwise.
return level.level == this.level;
{Boolean}
isGreaterOrEqualToo(level)
Determing if this level is >= another level
- Parameters:
- {comb.logging.Level} level
- the level to test against
- Returns:
- {Boolean} true if this is >= false otherwise.
var ret = false;
if (level && level instanceof Level) {
if (this.level >= level.level) {
ret = true;
}
}
return ret;
<static>
{comb.logging.Level|null}
comb.logging.Level.toLevel(level, defaultLevel)
Converts a numerical or string representation of a level, if a default level is provided,
then if a level cannot be determined then the default level is used.
- Parameters:
- {Number|String|comb.logging.Level} level
- the level to try to convert
- {comb.logging.Level} defaultLevel Optional
- default level to use if one cannot be determined,
- Returns:
- {comb.logging.Level|null} returns a level if one can be determined null otherwise.
var ret = null;
var args = base.argsToArray(arguments);
if (args.length === 1) {
var level = args[0];
if (level instanceof Level) {
ret = level;
} else if (base.isNumber(level)) {
var strLevel = LEVELS_REVERSE[level];
ret = Level[strLevel];
} else if (base.isString(level)) {
ret = Level[level.toUpperCase()];
}
} else {
ret = (Level.toLevel(args[0]) || args[1]);
}
return ret;
Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jan 31 2012 16:14:12 GMT-0600 (CST)