villadora / express-bunyan-logger

bunyan logger middleware for express
139 stars 74 forks source link

Don't mutate options #35

Open mpareja opened 8 years ago

mpareja commented 8 years ago

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));