1

I have a nodejs-express-mongoose application and I want to set logging system up. I know about connect.logger() middleware but I want to log into MongoDB database.

Can I achieve that by using overriding connect.logger() middleware of are some express plugins for my purposes?

4

1 回答 1

3

mongoose 有一个debug选项可以使用console.error. 你也可以用你自己的自定义函数覆盖它:

mongoose.set('debug', true) // for logging with console.error
mongoose.set('debug', yourFunction) // to handle it yourself
于 2012-05-31T23:27:25.453 回答