From 18ac355df394dacded977f936ef1723b24fbabc4 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 1 Sep 2023 18:37:31 +0800 Subject: [PATCH] chore(server): change the log level (#4106) --- apps/server/src/index.ts | 7 +++++-- apps/server/src/modules/auth/next-auth.controller.ts | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/server/src/index.ts b/apps/server/src/index.ts index 487580916f..eb74a4b511 100644 --- a/apps/server/src/index.ts +++ b/apps/server/src/index.ts @@ -27,7 +27,7 @@ import { Config } from './config'; import { serverTimingAndCache } from './middleware/timing'; import { RedisIoAdapter } from './modules/sync/redis-adapter'; -const { NODE_ENV } = process.env; +const { NODE_ENV, AFFINE_ENV } = process.env; if (NODE_ENV === 'production') { const traceExporter = new TraceExporter(); @@ -60,7 +60,10 @@ if (NODE_ENV === 'production') { const app = await NestFactory.create(AppModule, { cors: true, bodyParser: true, - logger: NODE_ENV === 'production' ? ['log'] : ['verbose'], + logger: + NODE_ENV !== 'production' || AFFINE_ENV !== 'production' + ? ['verbose'] + : ['log'], }); app.use(serverTimingAndCache); diff --git a/apps/server/src/modules/auth/next-auth.controller.ts b/apps/server/src/modules/auth/next-auth.controller.ts index b2464a504b..f931af4c34 100644 --- a/apps/server/src/modules/auth/next-auth.controller.ts +++ b/apps/server/src/modules/auth/next-auth.controller.ts @@ -127,6 +127,7 @@ export class NextAuthController { } if (redirect?.endsWith('api/auth/error?error=AccessDenied')) { + this.logger.debug(req.headers); if (!req.headers?.referer) { res.redirect('https://community.affine.pro/c/insider-general/'); } else {