Skip to content

HillTravis/log-util

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log-util

NPM Version NPM Downloads MIT License Dependency Status

NPM

NPM

node log utility, only for terminal output

log-util

usage

npm i --save log-util

var log = require('log-util');
log.verbose('verbose', 0);
log.debug('debug', 1);
log.info('info', 2);
log.warn('warn', 3);
log.error('error', 4);

new Log(level, dateFormat)

api

log.setLevel(level) => log

level is level id or level string

log.setDateFormat(dateFormat) => log

new log.Log(0) => log

log.levelArray

containing level corresponding

levelArray = [
    {
        level: 0,
        string: 'verbose',
        color: 'gray'
    },
    {
        level: 1,
        string: 'debug',
        color: 'green'
    },
    {
        level: 2,
        string: 'info',
        color: 'cyan'
    },
    {
        level: 3,
        string: 'warn',
        color: 'yellow'
    },
    {
        level: 4,
        string: 'error',
        color: 'red'
    }
]

log level

log.Log.VERBOSE === 0;
log.Log.DEBUG === 1;
log.Log.INFO === 2;
log.Log.WARN === 3;
log.Log.ERROR === 4;

date format

see https://github.com/felixge/node-dateformat

About

node log utility

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%