mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 08:07:28 +00:00
fix(logging ): use local timezone for console log timestamps (#25970)
Merged via squash.
Prepared head SHA: 30123265b7
Co-authored-by: openperf <80630709+openperf@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
@@ -3,7 +3,11 @@ import type { Logger as TsLogger } from "tslog";
|
||||
import { isVerbose } from "../globals.js";
|
||||
import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
|
||||
import { clearActiveProgressLine } from "../terminal/progress-line.js";
|
||||
import { getConsoleSettings, shouldLogSubsystemToConsole } from "./console.js";
|
||||
import {
|
||||
formatConsoleTimestamp,
|
||||
getConsoleSettings,
|
||||
shouldLogSubsystemToConsole,
|
||||
} from "./console.js";
|
||||
import { type LogLevel, levelToMinLevel } from "./levels.js";
|
||||
import { getChildLogger, isFileLogLevelEnabled } from "./logger.js";
|
||||
import { loggingState } from "./state.js";
|
||||
@@ -197,7 +201,7 @@ function formatConsoleLine(opts: {
|
||||
opts.style === "json" ? opts.subsystem : formatSubsystemForConsole(opts.subsystem);
|
||||
if (opts.style === "json") {
|
||||
return JSON.stringify({
|
||||
time: new Date().toISOString(),
|
||||
time: formatConsoleTimestamp("json"),
|
||||
level: opts.level,
|
||||
subsystem: displaySubsystem,
|
||||
message: opts.message,
|
||||
@@ -218,10 +222,10 @@ function formatConsoleLine(opts: {
|
||||
const displayMessage = stripRedundantSubsystemPrefixForConsole(opts.message, displaySubsystem);
|
||||
const time = (() => {
|
||||
if (opts.style === "pretty") {
|
||||
return color.gray(new Date().toISOString().slice(11, 19));
|
||||
return color.gray(formatConsoleTimestamp("pretty"));
|
||||
}
|
||||
if (loggingState.consoleTimestampPrefix) {
|
||||
return color.gray(new Date().toISOString());
|
||||
return color.gray(formatConsoleTimestamp(opts.style));
|
||||
}
|
||||
return "";
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user