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); }