lib/log.js
function (fn, module, data, verbose) {

        let complete = module.toUpperCase() + " > ";

            // Only provide verbose log if logLevel > 5
            verbose = config.logLevel >= 5 ? (verbose || undefined) : undefined;

        // When writing to console
        if ( config.destination === console) {

            // Compose message
            complete = " [ " + new Date().toLocaleString() + " ] " + complete + data;

            if ( fn == "error" ) 
                complete = complete.bgRed.white;
            else if ( fn == "warning" )
                complete = complete.bgYellow.black

        // ... when writing to a custom log function
        } else {
            complete += fn + ': ' + data;

        }

        // Check that destination.fn exists, fallback to destination.log
        let logger = (config.destination[fn] || config.destination.log).bind(config.destination);

        if ( verbose !== undefined ) {
            logger(complete, verbose);    
        } else {
            logger(complete);
        }
        
        
    }
function (fn, module, data, verbose) {

        let complete = module.toUpperCase() + " > ";

            // Only provide verbose log if logLevel > 5
            verbose = config.logLevel >= 5 ? (verbose || undefined) : undefined;

        // When writing to console
        if ( config.destination === console) {

            // Compose message
            complete = " [ " + new Date().toLocaleString() + " ] " + complete + data;

            if ( fn == "error" ) 
                complete = complete.bgRed.white;
            else if ( fn == "warning" )
                complete = complete.bgYellow.black

        // ... when writing to a custom log function
        } else {
            complete += fn + ': ' + data;

        }

        // Check that destination.fn exists, fallback to destination.log
        let logger = (config.destination[fn] || config.destination.log).bind(config.destination);

        if ( verbose !== undefined ) {
            logger(complete, verbose);    
        } else {
            logger(complete);
        }
        
        
    }
function ( fn , module , data , verbose ) { let complete = module . toUpperCase ( ) + " > " ; // Only provide verbose log if logLevel > 5 verbose = config . logLevel >= 5 ? ( verbose || undefined ) : undefined ; // When writing to console if ( config . destination === console ) { // Compose message complete = " [ " + new Date ( ) . toLocaleString ( ) + " ] " + complete + data ; if ( fn == "error" ) complete = complete . bgRed . white ; else if ( fn == "warning" ) complete = complete . bgYellow . black // ... when writing to a custom log function } else { complete += fn + ': ' + data ; } // Check that destination.fn exists, fallback to destination.log let logger = ( config . destination [ fn ] || config . destination . log ) . bind ( config . destination ) ; if ( verbose !== undefined ) { logger ( complete , verbose ) ; } else { logger ( complete ) ; } }
Log levels 0 = silent 1 = error 2 = warning 3 = log 4 = notice 5 = verbose Private
Log levels 0 = silent 1 = error 2 = warning 3 = log 4 = notice 5 = verbose Private