Skip to content

Commit

Permalink
fix: improve logs
Browse files Browse the repository at this point in the history
  • Loading branch information
devthejo committed Dec 16, 2024
1 parent 0dd4b40 commit fc7f30e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const port = config.port;
// Add request logging middleware
app.use(pinoHttp({
logger,
autoLogging: {
ignore: (req) => req.url === '/health'
},
customLogLevel: function (res, err) {
if (res.statusCode >= 400 && res.statusCode < 500) return 'warn'
if (res.statusCode >= 500 || err) return 'error'
Expand Down Expand Up @@ -283,7 +286,6 @@ app.post('/generate-token', async (req, res) => {

// Health check endpoint
app.get('/health', (req, res) => {
req.log.info('Health check requested');
res.json({ status: 'ok' });
});

Expand Down

0 comments on commit fc7f30e

Please sign in to comment.