From 27689faf41a508e4c100f9b31474eb8593a742a8 Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com> Date: Thu, 24 Apr 2025 20:06:28 +0530 Subject: [PATCH] fix(api): adjust logging in bouncer, downgrade to trace (#59945) --- api/src/plugins/bouncer.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/src/plugins/bouncer.ts b/api/src/plugins/bouncer.ts index 36deb181d6e..a7598ddcd29 100644 --- a/api/src/plugins/bouncer.ts +++ b/api/src/plugins/bouncer.ts @@ -21,8 +21,8 @@ const plugin: FastifyPluginCallback = (fastify, _options, done) => { if (!req.user) { const logger = fastify.log.child({ req }); - logger.debug( - 'User tried to access a protected route without being authenticated.' + logger.trace( + 'Protected route accessed by unauthenticated user. Sent 401.' ); await reply.status(401).send({ @@ -38,8 +38,8 @@ const plugin: FastifyPluginCallback = (fastify, _options, done) => { async function (req: FastifyRequest, reply: FastifyReply) { const logger = fastify.log.child({ req }); if (!req.user) { - logger.debug( - 'User tried to access a protected route without being authenticated.' + logger.trace( + 'Protected route accessed by unauthenticated user. Redirecting to login.' ); const { origin } = getRedirectParams(req); await reply.redirectWithMessage(origin, { @@ -59,7 +59,7 @@ const plugin: FastifyPluginCallback = (fastify, _options, done) => { const { returnTo } = getRedirectParams(req); - logger.debug(`User is being redirected to: ${returnTo}`); + logger.trace(`User ${req.user?.id} redirected to: ${returnTo}`); await reply.redirect(returnTo); }