mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -3,9 +3,9 @@ import fs from "node:fs";
|
||||
import json5 from "json5";
|
||||
|
||||
import { resolveConfigPath } from "../config/paths.js";
|
||||
import type { ClawdbotConfig } from "../config/types.js";
|
||||
import type { MoltbotConfig } from "../config/types.js";
|
||||
|
||||
type LoggingConfig = ClawdbotConfig["logging"];
|
||||
type LoggingConfig = MoltbotConfig["logging"];
|
||||
|
||||
export function readLoggingConfig(): LoggingConfig | undefined {
|
||||
const configPath = resolveConfigPath();
|
||||
|
||||
@@ -126,7 +126,7 @@ describe("enableConsoleCapture", () => {
|
||||
});
|
||||
|
||||
function tempLogPath() {
|
||||
return path.join(os.tmpdir(), `clawdbot-log-${crypto.randomUUID()}.log`);
|
||||
return path.join(os.tmpdir(), `moltbot-log-${crypto.randomUUID()}.log`);
|
||||
}
|
||||
|
||||
function eioError() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createRequire } from "node:module";
|
||||
import util from "node:util";
|
||||
|
||||
import type { ClawdbotConfig } from "../config/types.js";
|
||||
import type { MoltbotConfig } from "../config/types.js";
|
||||
import { isVerbose } from "../globals.js";
|
||||
import { stripAnsi } from "../terminal/ansi.js";
|
||||
import { type LogLevel, normalizeLogLevel } from "./levels.js";
|
||||
@@ -32,7 +32,7 @@ function normalizeConsoleStyle(style?: string): ConsoleStyle {
|
||||
}
|
||||
|
||||
function resolveConsoleSettings(): ConsoleSettings {
|
||||
let cfg: ClawdbotConfig["logging"] | undefined =
|
||||
let cfg: MoltbotConfig["logging"] | undefined =
|
||||
(loggingState.overrideSettings as LoggerSettings | null) ?? readLoggingConfig();
|
||||
if (!cfg) {
|
||||
if (loggingState.resolvingConsoleSettings) {
|
||||
@@ -41,7 +41,7 @@ function resolveConsoleSettings(): ConsoleSettings {
|
||||
loggingState.resolvingConsoleSettings = true;
|
||||
try {
|
||||
const loaded = requireConfig("../config/config.js") as {
|
||||
loadConfig?: () => ClawdbotConfig;
|
||||
loadConfig?: () => MoltbotConfig;
|
||||
};
|
||||
cfg = loaded.loadConfig?.().logging;
|
||||
} catch {
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from "node:path";
|
||||
|
||||
import { Logger as TsLogger } from "tslog";
|
||||
|
||||
import type { ClawdbotConfig } from "../config/types.js";
|
||||
import type { MoltbotConfig } from "../config/types.js";
|
||||
import type { ConsoleStyle } from "./console.js";
|
||||
import { type LogLevel, levelToMinLevel, normalizeLogLevel } from "./levels.js";
|
||||
import { readLoggingConfig } from "./config.js";
|
||||
@@ -12,10 +12,10 @@ import { loggingState } from "./state.js";
|
||||
|
||||
// Pin to /tmp so mac Debug UI and docs match; os.tmpdir() can be a per-user
|
||||
// randomized path on macOS which made the “Open log” button a no-op.
|
||||
export const DEFAULT_LOG_DIR = "/tmp/clawdbot";
|
||||
export const DEFAULT_LOG_FILE = path.join(DEFAULT_LOG_DIR, "clawdbot.log"); // legacy single-file path
|
||||
export const DEFAULT_LOG_DIR = "/tmp/moltbot";
|
||||
export const DEFAULT_LOG_FILE = path.join(DEFAULT_LOG_DIR, "moltbot.log"); // legacy single-file path
|
||||
|
||||
const LOG_PREFIX = "clawdbot";
|
||||
const LOG_PREFIX = "moltbot";
|
||||
const LOG_SUFFIX = ".log";
|
||||
const MAX_LOG_AGE_MS = 24 * 60 * 60 * 1000; // 24h
|
||||
|
||||
@@ -52,12 +52,12 @@ function attachExternalTransport(logger: TsLogger<LogObj>, transport: LogTranspo
|
||||
}
|
||||
|
||||
function resolveSettings(): ResolvedSettings {
|
||||
let cfg: ClawdbotConfig["logging"] | undefined =
|
||||
let cfg: MoltbotConfig["logging"] | undefined =
|
||||
(loggingState.overrideSettings as LoggerSettings | null) ?? readLoggingConfig();
|
||||
if (!cfg) {
|
||||
try {
|
||||
const loaded = requireConfig("../config/config.js") as {
|
||||
loadConfig?: () => ClawdbotConfig;
|
||||
loadConfig?: () => MoltbotConfig;
|
||||
};
|
||||
cfg = loaded.loadConfig?.().logging;
|
||||
} catch {
|
||||
@@ -88,7 +88,7 @@ function buildLogger(settings: ResolvedSettings): TsLogger<LogObj> {
|
||||
pruneOldRollingLogs(path.dirname(settings.file));
|
||||
}
|
||||
const logger = new TsLogger<LogObj>({
|
||||
name: "clawdbot",
|
||||
name: "moltbot",
|
||||
minLevel: levelToMinLevel(settings.level),
|
||||
type: "hidden", // no ansi formatting
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createRequire } from "node:module";
|
||||
|
||||
import type { ClawdbotConfig } from "../config/config.js";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
|
||||
const requireConfig = createRequire(import.meta.url);
|
||||
|
||||
@@ -97,10 +97,10 @@ function redactText(text: string, patterns: RegExp[]): string {
|
||||
}
|
||||
|
||||
function resolveConfigRedaction(): RedactOptions {
|
||||
let cfg: ClawdbotConfig["logging"] | undefined;
|
||||
let cfg: MoltbotConfig["logging"] | undefined;
|
||||
try {
|
||||
const loaded = requireConfig("../config/config.js") as {
|
||||
loadConfig?: () => ClawdbotConfig;
|
||||
loadConfig?: () => MoltbotConfig;
|
||||
};
|
||||
cfg = loaded.loadConfig?.().logging;
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user