How to use the express-winston.bodyWhitelist function in express-winston

To help you get started, we’ve selected a few express-winston examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paypal / appsforhere / index.js View on Github external
App.prototype.configureExpressWinston = function () {
    var app = this.express;
    app.on('middleware:after:router', function addExpressWinston() {
        app.use(expressWinston.errorLogger({
            winstonInstance: logger._impl
        }));
    });

    expressWinston.requestWhitelist = ['url', 'headers', 'method', 'httpVersion', 'originalUrl', 'query'];
    expressWinston.bodyWhitelist = ['none'];

    var ewLogger = expressWinston.logger({
        winstonInstance: logger._impl,
        msg: "{{req.method}} {{req.logSafeUrl}} {{res.statusCode}} {{res.responseTime}}ms",
        meta: false
    });
    app.use(function (req, res, next) {
        var badParams = /uuid=(.+[^0-9\-])/g;
        req.logSafeUrl = req.url.replace(badParams, 'uuid=*');
        return ewLogger(req, res, next);
    });
};

express-winston

express.js middleware for winstonjs/winston

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis