mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 22:14:34 +00:00
refactor(logging): migrate non-agent internal console calls to subsystem logger (#22964)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: b4a5b12422
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
committed by
GitHub
parent
4ef4aa3c10
commit
2f46308d5a
@@ -1,4 +1,5 @@
|
||||
import { RateLimitError } from "@buape/carbon";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { formatErrorMessage } from "./errors.js";
|
||||
import { type RetryConfig, resolveRetryConfig, retryAsync } from "./retry.js";
|
||||
|
||||
@@ -19,6 +20,7 @@ export const TELEGRAM_RETRY_DEFAULTS = {
|
||||
};
|
||||
|
||||
const TELEGRAM_RETRY_RE = /429|timeout|connect|reset|closed|unavailable|temporarily/i;
|
||||
const log = createSubsystemLogger("retry-policy");
|
||||
|
||||
function getTelegramRetryAfterMs(err: unknown): number | undefined {
|
||||
if (!err || typeof err !== "object") {
|
||||
@@ -61,7 +63,7 @@ export function createDiscordRetryRunner(params: {
|
||||
? (info) => {
|
||||
const labelText = info.label ?? "request";
|
||||
const maxRetries = Math.max(1, info.maxAttempts - 1);
|
||||
console.warn(
|
||||
log.warn(
|
||||
`discord ${labelText} rate limited, retry ${info.attempt}/${maxRetries} in ${info.delayMs}ms`,
|
||||
);
|
||||
}
|
||||
@@ -92,7 +94,7 @@ export function createTelegramRetryRunner(params: {
|
||||
onRetry: params.verbose
|
||||
? (info) => {
|
||||
const maxRetries = Math.max(1, info.maxAttempts - 1);
|
||||
console.warn(
|
||||
log.warn(
|
||||
`telegram send retry ${info.attempt}/${maxRetries} for ${info.label ?? label ?? "request"} in ${info.delayMs}ms: ${formatErrorMessage(info.err)}`,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user