Open bigriot opened 5 years ago
Hi @bigriot !
You can try something like this
app.use(async (ctx, next) => {
if (ctx.url === '/ping') {
await next();
} else {
await logger()(ctx, next);
}
});
This method is not ideal.
If the ignored route uses a log function ctx.log.info
, then it will cause an error.
My server receives health check pings from a load balancer via '/ping'.
The health check happens every 30 seconds so meaningless logs will pile up rather quickly, especially if I've got multiple instances running at the same time.
I think hapi-pino has something like this with an ignorePaths option, and was wondering if we could get something similar for koa.