@kobionic/logger
TypeScript icon, indicating that this package has built-in type declarations

5.0.2 • Public • Published

Logger

npm version License Code style Build status

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

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Package Sidebar

Install

npm i @kobionic/logger

Weekly Downloads

0

Version

5.0.2

License

Apache-2.0

Unpacked Size

20.2 kB

Total Files

6

Last publish

Collaborators

  • jeremiergz