fix: reuse shared ansi stripper
This commit is contained in:
@@ -74,6 +74,7 @@ Docs: https://docs.clawd.bot
|
|||||||
- Verbose: wrap tool summaries/output in markdown only for markdown-capable channels.
|
- Verbose: wrap tool summaries/output in markdown only for markdown-capable channels.
|
||||||
- Tools: include provider/session context in elevated exec denial errors.
|
- Tools: include provider/session context in elevated exec denial errors.
|
||||||
- Tools: normalize exec tool alias naming in tool error logs.
|
- Tools: normalize exec tool alias naming in tool error logs.
|
||||||
|
- Logging: reuse shared ANSI stripping to keep console capture lint-clean.
|
||||||
- Telegram: accept tg/group/telegram prefixes + topic targets for inline button validation. (#1072) — thanks @danielz1z.
|
- Telegram: accept tg/group/telegram prefixes + topic targets for inline button validation. (#1072) — thanks @danielz1z.
|
||||||
- Telegram: split long captions into follow-up messages.
|
- Telegram: split long captions into follow-up messages.
|
||||||
- Config: block startup on invalid config, preserve best-effort doctor config, and keep rolling config backups. (#1083) — thanks @mukhtharcm.
|
- Config: block startup on invalid config, preserve best-effort doctor config, and keep rolling config backups. (#1083) — thanks @mukhtharcm.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import util from "node:util";
|
|||||||
|
|
||||||
import { type ClawdbotConfig, loadConfig } from "../config/config.js";
|
import { type ClawdbotConfig, loadConfig } from "../config/config.js";
|
||||||
import { isVerbose } from "../globals.js";
|
import { isVerbose } from "../globals.js";
|
||||||
|
import { stripAnsi } from "../terminal/ansi.js";
|
||||||
import { type LogLevel, normalizeLogLevel } from "./levels.js";
|
import { type LogLevel, normalizeLogLevel } from "./levels.js";
|
||||||
import { getLogger, type LoggerSettings } from "./logger.js";
|
import { getLogger, type LoggerSettings } from "./logger.js";
|
||||||
import { loggingState } from "./state.js";
|
import { loggingState } from "./state.js";
|
||||||
@@ -120,10 +121,6 @@ function isJsonPayload(value: string): boolean {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stripAnsi(value: string): string {
|
|
||||||
return value.replace(/\u001b\[[0-9;]*m/g, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route console.* calls through file logging while still emitting to stdout/stderr.
|
* Route console.* calls through file logging while still emitting to stdout/stderr.
|
||||||
* This keeps user-facing output unchanged but guarantees every console call is captured in log files.
|
* This keeps user-facing output unchanged but guarantees every console call is captured in log files.
|
||||||
|
|||||||
Reference in New Issue
Block a user