winston和winston-mongodb设置为我的快递应用记录日志。问题是它只记录我在根目录下的端点日志,例如localhost:3000 / apidocs或localhost:3000 / index但是我在localhost:3000 / api / v1 / customers上有一个完整的REST应用程序。在向任何此类地址发出请求时,它不显示任何日志。以下代码显示了我如何设置表达winston。
winston.add(MongoDB, {db:'logs'});
app.use(expressWinston.logger({
transports: [
new winston.transports.Console({
json: true,
colorize: true
}),
new (winston.transports.MongoDB)(
{
db : 'logs',
}
)
]
}));
app.use(app.router);
app.use(expressWinston.errorLogger({
transports: [
new winston.transports.Console({
json: true,
colorize: true
}),
new (winston.transports.MongoDB)(
{
db : 'logs',
}
)
]
}));
任何帮助都会非常感激。