1.0.7 • Published 4 years ago

colorful-log v1.0.7

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

colorful-log

Simple, lightweight and good looking logger.

Installation

npm i colorful-log

Usage

All the options are optional, you can even just use new Logger() without passing any opts.

import Logger from 'colorful-log';

const log = new Logger({
    debug: false, // default is set to true
    path: './logs', // which is default
    system: 'test',
    cluster: 0,
    saveInterval: 60000 // 60 secs
})

log.info('info');
log.warn('warn');
log.error('error');
log.debug('debug'); // won't print out since debug is set to false, but still save to log files

throw new Error('fatal'); 
// uncaughtException & unhandledRejection will be catched and logged, then exit (as it should be)

Manual Save

log.save() method returns a Promise, it's the same method that was called when saveInterval reached.

(async () => await log.save().catch(log.error))();
1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago