csausdev/log4js-node — Issue #51: logger.isLevelEnabled('debug') fail
Author: changchang
Created: 2011-12-27 06:30:57+00:00
State: open

I pass a string parameter to isLevelEnabled and it throw an exception:

[2011-12-27 13:55:14.197] [ERROR] app - Caught exception: TypeError: Object function Level(level, levelStr) {
this.level = level;
this.levelStr = levelStr;
} has no method 'toLevel'
at Level.isLessThanOrEqualTo (/home/chang/program/workspace/webgame-demo/node_modules/log4js/lib/levels.js:34:28)
at Logger.isLevelEnabled (/home/chang/program/workspace/webgame-demo/node_modules/log4js/lib/log4js.js:219:23)

I checkout the source code of levels.js and found that toLevel seems just a normal function but not a instance method of class Level.

If I pass logger.levels.DEBUG to isLevelEnabled, it will work well.