openclaw/src/config/logging.ts

19 lines
599 B
TypeScript
Raw Normal View History

2026-01-23 04:16:32 +00:00
import type { RuntimeEnv } from "../runtime.js";
import { displayPath } from "../utils.js";
import { createConfigIO } from "./io.js";
2026-01-23 04:16:32 +00:00
type LogConfigUpdatedOptions = {
path?: string;
suffix?: string;
};
export function formatConfigPath(path: string = createConfigIO().configPath): string {
2026-01-23 04:16:32 +00:00
return displayPath(path);
}
export function logConfigUpdated(runtime: RuntimeEnv, opts: LogConfigUpdatedOptions = {}): void {
const path = formatConfigPath(opts.path ?? createConfigIO().configPath);
2026-01-23 04:16:32 +00:00
const suffix = opts.suffix ? ` ${opts.suffix}` : "";
runtime.log(`Updated ${path}${suffix}`);
}