Common config for Winston logger
const { getPreconfiguredLogger } = require('@bookmate/preconfigured-winston-logger');
const env = require('env'); // a custom environment information manager
const logger = getPreconfiguredLogger({
environment: env.getEnvironment()
});
environment
, optional, — eitherproduction
ordevelopment
requestIdGetter
, optional, – a function that accepts Express'req
object and gets its identifier (relevant only in prod environment)
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).