we use morgan
in order to log our express transformation:
var morgan = require('morgan');
morgan('combined');
// a format string
morgan(':remote-addr :method :url :uuid');
// a custom function
morgan(function (req, res) {
return req.method + ' ' + req.url + ' ' + req.uuid;
})
Also, we use winston
in order to log our other logging:
var winston = require('winston');
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({ level: 'info' }),
new (winston.transports.File)({ filename: '/var/log/log-file.log' })
]
});
Is there any way to combine the two loggers together? the situation now is that morgan
is write to my standard output, when winston
writes to /var/log/log-file.log
.
I wish that the logger file will combine from the express transformation information, and from the other information I want (logger.info()
)..