diff --git a/src/lib/logger.ts b/src/lib/logger.ts index 2f42f21..9503559 100644 --- a/src/lib/logger.ts +++ b/src/lib/logger.ts @@ -77,17 +77,6 @@ export enum LogOperation { RETRYING_RATE_LIMIT = "retrying_rate_limit", } -/** - * Numeric log level values (Pino convention). - */ -const LOG_LEVEL_VALUES: Record = { - trace: 10, - debug: 20, - info: 30, - warn: 40, - error: 50, -}; - /** * Valid log level strings. */ @@ -128,21 +117,6 @@ function getFileLogLevel(): LogLevel { return "debug"; } -/** - * Get the console log level. - * Console shows max('info', file level) - never shows debug. - * - * @returns The calculated console log level - */ -function getConsoleLogLevel(): LogLevel { - const fileLevel = getFileLogLevel(); - const fileLevelValue = LOG_LEVEL_VALUES[fileLevel]; - const infoLevelValue = LOG_LEVEL_VALUES.info; - - // Console level is max of (info, file level) - return fileLevelValue > infoLevelValue ? fileLevel : "info"; -} - /** * Get the log directory from environment. * @@ -209,14 +183,13 @@ async function createRootLogger(): Promise { // Console transport: opt-in only (ASK262_LOG_CONSOLE=true) if (process.env.ASK262_LOG_CONSOLE === "true") { - const consoleLevel = getConsoleLogLevel(); const consoleStream = pretty({ colorize: true, translateTime: "SYS:standard", ignore: "pid,hostname", destination: process.stderr, }); - streams.push({ stream: consoleStream, level: consoleLevel }); + streams.push({ stream: consoleStream, level: fileLevel }); } return pino(