adhisimon-logger
v1.0.5
Published
My simple logger (based on winston)
Downloads
5
Readme
adhisimon-logger
My simple logger (based on winston).
It just init winston to display fancy colored logs on console with metadata that I think was important. Also put logs on rotating files if it's not running on unit test.
Installation
npm i adisimon-logger
Usage
const { create: createLogger } = require('adhisimon-logger');
const logger = createLogger({
// all options are optional, here are default values
level: 'verbose', // or process.env.LOG_LEVEL
disableFileTransport: false, // it would always ignored if running on unit test
dir: 'logs', // or process.env.LOG_DIR
fileLevel: 'verbose', // will use "level" options if not specified
baseFilename: 'app', // or process.env.LOG_BASE_FILENAME
keepFiles: 31, // or process.env.LOG_KEEP_FILES
});
Unit test detection
It detect unit test by detecting global "describe" function does exists.
Changelog
See CHANGELOG.md file.
Planned transports
I have plan to implement these transports too:
- http transport
- mysql transport
- amqp transport
- redis transport
License
This package based on winston which has MIT License, so this package too.
See it on LICENSE file.