Skip to content

Commit

Permalink
Append LogRecord args to defaultLogFormatter
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiker committed Aug 17, 2023
1 parent 58a8b50 commit 298d6e4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions logUtils.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 298d6e4

Please sign in to comment.