I'm trying to use mongo-morgan . I use it like the original morgan package, but I don't get any response in terminal logs.
I have tried this (changing 'url' to my database url):
app.use(mongoMorgan('url', 'dev'));
and this (from the mongo-morgan repository):
app.use(mongoMorgan('url', 'combined', { collection: 'logs'}));
mongomorgan has an onConnect() function. If you want to be notified whenever you get a connection to the database, i think you should log the message in this function. It's signature is function onConnect(error, mongoDb)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.