From 8901d484f48e28ee01343a754a67d572b100e8be Mon Sep 17 00:00:00 2001 From: Mizuki Date: Thu, 17 Aug 2023 15:43:17 +0900 Subject: [PATCH] Append LogRecord args to defaultLogFormatter --- logUtils.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/logUtils.ts b/logUtils.ts index a934b9f..347299b 100644 --- a/logUtils.ts +++ b/logUtils.ts @@ -1,5 +1,10 @@ import { format as formatDate } from "std/datetime/mod.ts"; -import { type LoggerConfig, LogLevels, type LogRecord } from "std/log/mod.ts"; +import { + Logger, + type LoggerConfig, + LogLevels, + type LogRecord, +} from "std/log/mod.ts"; import { type LevelName, LogLevelNames } from "std/log/levels.ts"; import { combinedEnv, LogLevelEnvKey } from "./envUtils.ts"; @@ -39,7 +44,9 @@ export function defaultLogFormatter(rec: LogRecord) { } return `[${ formatDate(new Date(), "yyyy-MM-dd HH:mm:ss") - } ${level}][${rec.loggerName}] ${rec.msg}`; + } ${level}][${rec.loggerName}] ${ + [rec.msg, ...rec.args.map(Logger.prototype.asString)].join(" ") + }`; } export function getLoggingLevel() {