Skip to content

Latest commit

 

History

History
24 lines (16 loc) · 965 Bytes

README.md

File metadata and controls

24 lines (16 loc) · 965 Bytes

@bookmate/preconfigured-winston-logger

Summary

Common config for Winston logger

Usage

const { getPreconfiguredLogger } = require('@bookmate/preconfigured-winston-logger');

const env = require('env'); // a custom environment information manager

const logger = getPreconfiguredLogger({
  environment: env.getEnvironment()
});

Options of getPreconfiguredLogger

  • environment, optional, — either production or development
  • requestIdGetter, optional, – a function that accepts Express' req object and gets its identifier (relevant only in prod environment)

Note

When using with express-winston, the version of express-winston should be at least 3 (the logger is expecting the Express request object to be passed to it in the meta field, which was added only in this commit).