refactor(logging): split config + subsystem imports

This commit is contained in:
Peter Steinberger
2026-01-18 23:24:17 +00:00
parent ee36e12f81
commit 50fdd514ae
48 changed files with 109 additions and 72 deletions

View File

@@ -4,9 +4,10 @@ import path from "node:path";
import { Logger as TsLogger } from "tslog";
import type { ClawdbotConfig } from "../config/config.js";
import type { ClawdbotConfig } from "../config/types.js";
import type { ConsoleStyle } from "./console.js";
import { type LogLevel, levelToMinLevel, normalizeLogLevel } from "./levels.js";
import { readLoggingConfig } from "./config.js";
import { loggingState } from "./state.js";
// Pin to /tmp so mac Debug UI and docs match; os.tmpdir() can be a per-user
@@ -36,10 +37,9 @@ type ResolvedSettings = {
export type LoggerResolvedSettings = ResolvedSettings;
function resolveSettings(): ResolvedSettings {
let cfg: ClawdbotConfig["logging"] | undefined;
if (loggingState.overrideSettings) {
cfg = loggingState.overrideSettings as LoggerSettings;
} else {
let cfg: ClawdbotConfig["logging"] | undefined =
(loggingState.overrideSettings as LoggerSettings | null) ?? readLoggingConfig();
if (!cfg) {
try {
const loaded = requireConfig("../config/config.js") as {
loadConfig?: () => ClawdbotConfig;