I'm using node.js with express-winston for logging, like that:
var express = require('express');
var app = express();
var winston = require('winston');
var expressWinston = require('express-winston');
var routes = require('./routes/index');
app.use("/", routes);
app.use(
expressWinston.errorLogger({
transports: [
new winston.transports.DailyRotateFile({
name: 'file',
datePattern: '_dd-MM-yyyy.log',
colorize: true,
json: true,
filename: './logs/errors/error_log',
maxsize: 50 * 1024 * 1024,
maxFiles: 10,
zippedArchive: true
}),
new winston.transports.Console({
json: true,
colorize: true
})
],
skip: function(req, res) {
return true;
}
})
);
Notice that I'm using the skip function and returning true (for test purpose) in order to skip all error logging like written here: express-winston options
but it doesn't work, any ideas?
the
skip
function is called after response has been sent as per the README.md:For your example you want to use the
ignoreRoute
option which for your case would be a function that returnstrue
.