Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Logging Levels #2

Closed
digitalrinaldo opened this Issue Apr 27, 2012 · 1 comment

Comments

Projects
None yet
2 participants

Thanks for the easy to use package. A few questions.

Is there a way to get log4j behavior with the logging levels. If one sets level.warn all levels up to warn should print, not just those at warn and above. The inverse of how it currently works.

Is 'log' supposed to be the level that prints all?

I did not see a way to set a level once you have already configured a logger.

Owner

baryon commented May 1, 2012

if you want change config in runtime, write code like

var conf = {
        log_dev : {
            strategy : 'colorConsole',
            setting : {
                level : 'log'
            }
        },
        log_prd : {
            strategy : 'console',
            setting : {
                level : 'warn'
            }
        }
};

var tracer = require('tracer')

function test(c){
    var logger = tracer[c.strategy](c.setting);
    logger.log('hello');
    logger.trace('hello', 'world');
    logger.debug('hello %s', 'world', 123);
    logger.warn('hello %s', 'world', 123);
    logger.error('hello %s', 'world', 123);
}


test(conf.log_dev);

test(conf.log_prd);

@baryon baryon closed this Jun 22, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment