structured-logging-next
Version:
Bunyan stream used to format logger input based on a JSON schema.
17 lines (11 loc) • 388 B
JavaScript
;
const bunyan = require('bunyan');
const resSerializer = res => {
const serializedRes = bunyan.stdSerializers.res(res);
// Fixes Bunyan bug while waiting for merge of: https://github.com/trentm/node-bunyan/pull/149
if (!serializedRes.header && res._headers) {
serializedRes.header = res._headers;
}
return serializedRes;
};
module.exports = resSerializer;