refactor: add config logging helpers
This commit is contained in:
18
src/config/logging.ts
Normal file
18
src/config/logging.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { displayPath } from "../utils.js";
|
||||
import { CONFIG_PATH_CLAWDBOT } from "./paths.js";
|
||||
|
||||
type LogConfigUpdatedOptions = {
|
||||
path?: string;
|
||||
suffix?: string;
|
||||
};
|
||||
|
||||
export function formatConfigPath(path: string = CONFIG_PATH_CLAWDBOT): string {
|
||||
return displayPath(path);
|
||||
}
|
||||
|
||||
export function logConfigUpdated(runtime: RuntimeEnv, opts: LogConfigUpdatedOptions = {}): void {
|
||||
const path = formatConfigPath(opts.path ?? CONFIG_PATH_CLAWDBOT);
|
||||
const suffix = opts.suffix ? ` ${opts.suffix}` : "";
|
||||
runtime.log(`Updated ${path}${suffix}`);
|
||||
}
|
||||
Reference in New Issue
Block a user