Skip to content

Instantly share code, notes, and snippets.

View jdmar3's full-sized avatar

John D. Martin III jdmar3

View GitHub Profile
@jdmar3
jdmar3 / logging-middleware.js
Last active March 8, 2022 18:10 — forked from cgmartin/logging-middleware.js
Morgan JSON log format example
'use strict';
const morgan = require('morgan');
module.exports = function jsonLog() {
return morgan(jsonFormat);
};
function jsonFormat(tokens, req, res) {
return JSON.stringify({
'remote-address': tokens['remote-addr'](req, res),