chore(server): change the log level (#4106)

This commit is contained in:
LongYinan
2023-09-01 18:37:31 +08:00
committed by GitHub
parent c0bf82d3ff
commit 18ac355df3
2 changed files with 6 additions and 2 deletions

View File

@@ -27,7 +27,7 @@ import { Config } from './config';
import { serverTimingAndCache } from './middleware/timing'; import { serverTimingAndCache } from './middleware/timing';
import { RedisIoAdapter } from './modules/sync/redis-adapter'; import { RedisIoAdapter } from './modules/sync/redis-adapter';
const { NODE_ENV } = process.env; const { NODE_ENV, AFFINE_ENV } = process.env;
if (NODE_ENV === 'production') { if (NODE_ENV === 'production') {
const traceExporter = new TraceExporter(); const traceExporter = new TraceExporter();
@@ -60,7 +60,10 @@ if (NODE_ENV === 'production') {
const app = await NestFactory.create<NestExpressApplication>(AppModule, { const app = await NestFactory.create<NestExpressApplication>(AppModule, {
cors: true, cors: true,
bodyParser: true, bodyParser: true,
logger: NODE_ENV === 'production' ? ['log'] : ['verbose'], logger:
NODE_ENV !== 'production' || AFFINE_ENV !== 'production'
? ['verbose']
: ['log'],
}); });
app.use(serverTimingAndCache); app.use(serverTimingAndCache);

View File

@@ -127,6 +127,7 @@ export class NextAuthController {
} }
if (redirect?.endsWith('api/auth/error?error=AccessDenied')) { if (redirect?.endsWith('api/auth/error?error=AccessDenied')) {
this.logger.debug(req.headers);
if (!req.headers?.referer) { if (!req.headers?.referer) {
res.redirect('https://community.affine.pro/c/insider-general/'); res.redirect('https://community.affine.pro/c/insider-general/');
} else { } else {