Logger
Nothing new here, just a customized logger. Btw, thank you Winston.
Installation
npm install @kobionic/logger
Usage
import logger from '@kobionic/logger';
import Koa from 'koa';
logger.info('Hi there!');
const app = new Koa();
app.use(logger.getHttpLogger('koa'));
Configuration
Configuration of the logger is done using environment variables. Available variables are described below:
Variable | Type | Default | Description |
---|---|---|---|
FORCE_COLOR |
number | 1 | removes colorization from logging output if set to 0 |
LOGGER_CORRELATION_ID |
string | randomly generated | overrides randomly generated logger correlation ID |
LOGGER_DIR |
string | ./logs | sets log file(s) directory |
LOGGER_LEVEL |
string | info | sets logging level (debug | error | info | none) |
LOGGER_NAME |
string | [application name]-[YYYY-MM-DD].[json|log] | overrides dynamically generated log file name |
LOGGER_PRINT_CORRELATION_ID |
boolean | false | adds correlation ID to the logging output if set to true |
LOGGER_WRITE_TO_FILE |
boolean | false | writes logging output to a .json and .log files if set to true |
Run Tests
npm test
Authors
- Jeremie Rodriguez <jeremie.rodriguez@kobionic.com> - Main developer
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.