express-bunyan-logger icon indicating copy to clipboard operation
express-bunyan-logger copied to clipboard

Don't mutate options

Open mpareja opened this issue 8 years ago • 0 comments

The passed in options are mutated by express-bunyan-logger. That doesn't work well when you want to share config settings between the standard and error logger.

https://github.com/villadora/express-bunyan-logger/blob/master/index.js#L30

Mutation breaks the following use-case:

var options = { format: ':res[statusCode] :method' };
app.use(logger(options));
  ...
app.use(logger.errorLogger(options));

mpareja avatar Feb 01 '16 15:02 mpareja