mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-22 13:08:11 +00:00
logging: isolate test logs to /tmp/openclaw-test under vitest
This commit is contained in:
@@ -9,7 +9,18 @@ import { readLoggingConfig } from "./config.js";
|
||||
import { type LogLevel, levelToMinLevel, normalizeLogLevel } from "./levels.js";
|
||||
import { loggingState } from "./state.js";
|
||||
|
||||
export const DEFAULT_LOG_DIR = resolvePreferredOpenClawTmpDir();
|
||||
// When running under vitest, isolate logs to avoid polluting production logs.
|
||||
function getDefaultLogDir(): string {
|
||||
if (process.env.OPENCLAW_LOG_DIR) {
|
||||
return process.env.OPENCLAW_LOG_DIR;
|
||||
}
|
||||
if (process.env.VITEST === "true") {
|
||||
return "/tmp/openclaw-test";
|
||||
}
|
||||
return resolvePreferredOpenClawTmpDir();
|
||||
}
|
||||
|
||||
export const DEFAULT_LOG_DIR = getDefaultLogDir();
|
||||
export const DEFAULT_LOG_FILE = path.join(DEFAULT_LOG_DIR, "openclaw.log"); // legacy single-file path
|
||||
|
||||
const LOG_PREFIX = "openclaw";
|
||||
|
||||
Reference in New Issue
Block a user