From 825078e6e7be4ee3fa4a8397c00f543db5bc27ea Mon Sep 17 00:00:00 2001 From: Clansty Date: Sun, 24 Mar 2024 06:35:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8F=AF=E4=BB=A5=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=20LOG=5FLEVEL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/src/index.ts | 3 ++- main/src/models/env.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/main/src/index.ts b/main/src/index.ts index f61de40..d7e89ae 100644 --- a/main/src/index.ts +++ b/main/src/index.ts @@ -2,6 +2,7 @@ import { configure, getLogger } from 'log4js'; import Instance from './models/Instance'; import db from './models/db'; import api from './api'; +import env from './models/env'; (async () => { configure({ @@ -9,7 +10,7 @@ import api from './api'; console: { type: 'console' }, }, categories: { - default: { level: 'debug', appenders: ['console'] }, + default: { level: env.LOG_LEVEL, appenders: ['console'] }, }, }); const log = getLogger('Main'); diff --git a/main/src/models/env.ts b/main/src/models/env.ts index 956eb36..e72eab4 100644 --- a/main/src/models/env.ts +++ b/main/src/models/env.ts @@ -3,6 +3,7 @@ import path from 'path'; const configParsed = z.object({ DATA_DIR: z.string().default(path.resolve('./data')), + LOG_LEVEL: z.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal', 'mark', 'off']).default('info'), OICQ_LOG_LEVEL: z.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal', 'mark', 'off']).default('warn'), TG_LOG_LEVEL: z.enum(['none', 'error', 'warn', 'info', 'debug']).default('warn'), FFMPEG_PATH: z.string().optional(),