express-winston
express-winston copied to clipboard
Expose meta to Template
The meta object can contain valuable information for the printed log format (such as the authenticated user), but it not used in the template process. The template functions should each be updated to the following:
exports.errorLogger = function errorLogger(options) {
// ...
options.winstonInstance.log({
level,
message: getTemplate(options.msg, {err: err, req: req, res: res, meta: exceptionMeta}),
meta: exceptionMeta
});
// ...
};
exports.logger = function logger(options) {
// ...
var msg = template({req: req, res: _.assign({}, res, coloredRes), meta});
// ...
};