node.js - Capture the instance of Morgan logger inside a router api -


i want print error of api route inside morgan log. logging should happen or error logged happens after request processed. how capture same instance of morgan inside specific route print log morgan log?

my morgan logs work fine. morgan instance put before routes this:

application.use(morgan(':processid :id :remote-addr :remote-user :status :res[content-length] :response-time ms :myerrorfromapishouldcomehere', {stream: instance}))  application.use(routes) 

the api should like:

routes.get('/api',function(req, res){    morgan.someapi.use('`:myerrorprintedhere`');    res.status(500).json(myresponse); }); 


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -