openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
27 lines (26 loc) • 1.32 kB
JavaScript
import { r as terminalText } from "./safe-text-C80HAQ2e.mjs";
import { r as resolveStateDir } from "./state-dir-DiG0gXzD.mjs";
import { a as displayPath } from "./utils-C8YECn2Q.mjs";
import { m as resolveConfigPath } from "./paths-DAcAg5aV.mjs";
import { r as theme } from "./theme-BOI0xyRZ.mjs";
import fs from "node:fs";
//#region src/config/logging.ts
/** Formats a config path for operator-facing log output. */
function formatConfigFilePath(e = resolveConfigPath(process.env, resolveStateDir())) {
return displayPath(e);
}
/** Builds the config-updated log message, including backup detail only when it exists. */
function formatConfigUpdatedMessage(e, t = {}) {
const n = theme.muted(formatConfigFilePath(e));
const r = t.suffix ? terminalText` ${t.suffix}` : "";
const i = t.backupPath === void 0 ? `${e}.bak` : t.backupPath;
const a = [`Updated config: ${n}${r}`];
if (i && fs.existsSync(i)) a.push(` Backup: ${theme.muted(formatConfigFilePath(i))}`);
return a.join("\n");
}
/** Emits the standard config-updated message through the active runtime logger. */
function logConfigUpdated(e, t = {}) {
e.log(formatConfigUpdatedMessage(t.path ?? resolveConfigPath(process.env, resolveStateDir()), t));
}
//#endregion
export { formatConfigUpdatedMessage as n, logConfigUpdated as r, formatConfigFilePath as t };