heapsource/express-winston — pull request #14 by xdamman (2013-12-02 05:04:19+00:00)
Title: Added the option to remove the meta and to customize the log message

I found the default logging to be very verbose. When a request is successful, I don't need to log all that data. So I just added new options: `options.meta = true/false` (to remove the meta object) and `options.msg` to customize the default logging message (using mustache like template)

e.g.

server.use(expressWinston.logger({
transports: [
new winston.transports.Console({
json: false
, colorize: true
}),
new winston.transports.File({
filename: "logs/access.log"
, json: false
, timestamp: true
})
]
, meta: false
, msg: "{{res.statusCode}} {{req.method}} {{res.responseTime}}ms {{req.url}}"
}));

Shows in the logs:

info: 304 GET 8ms /about