You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can do it with an error middleware instead of autologging. Here's how I did it:
constlogRequest=pinoHttp({level: 'info',enabled: true,autoLogging: false,});constapp=express();app.use(logRequest);app.get('/health',(req,res)=>{res.send('ok');});// Only works if it's placed after the routing calls such as app.get()app.use((err,req,res,next)=>{req.log.error(err)res.status(500).send('Internal Server Error')})app.listen(PORT,()=>{log.info(`server listening for requests on http://localhost:${PORT}`);});
Why would
autoLogging.ignore
not receive a response object. I would like to autolog only errored requests.The text was updated successfully, but these errors were encountered: