logger class based on rule-functions. uses the console, a file and trigger an event for more complex action.


is a super simple logger class for nodeJS. It's part of the VisualWeb Framework (currently not public). it will log to the console, a (mongoDB) database, a file. just pass the configuration options when instantiating a new logger and there you go.

    Logger = require('logger');
    var log = new Logger(
            rules: {
                minLogLevel: function(config, logTarget, content, sender, logLevel) {
                    if (logLevel < 2) return false;
                    return true;
        function(loggerInstance) { 
            // if you chose log2database, you will need to wait for the
            // callback to be able to actually log... 
    log.add('this is a message', 'cyan', 'byTest', 2);


error (1):

    myLogger.error('Test ERROR message.', 'red', 'examples');

warn (2):

    myLogger.warn('Test WARN message.', 'yellow', 'examples');

info (3):

    myLogger.info('Test INFO message.', 'green', 'examples');

debug (4):

    myLogger.debug('Test DEBUG message.', 'blink', 'examples');

trace (5):

    myLogger.trace('Test TRACE message.', 'white', 'examples');

If you are not sure how to use these loglevels, here is a nice description.