mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 08:10:42 +00:00
feat(cli/logs): announce --follow gateway reconnect and add JSON notice parity (#75372)
This commit is contained in:
@@ -341,15 +341,12 @@ export function registerLogsCli(program: Command) {
|
||||
if (opts.follow && followRetryAttempt < MAX_FOLLOW_RETRIES && isTransientFollowError(err)) {
|
||||
followRetryAttempt += 1;
|
||||
const backoffMs = computeBackoff(FOLLOW_BACKOFF_POLICY, followRetryAttempt);
|
||||
if (
|
||||
!errorLine(
|
||||
colorize(
|
||||
rich,
|
||||
theme.warn,
|
||||
`[logs] gateway disconnected, reconnecting in ${Math.round(backoffMs / 1_000)}s...`,
|
||||
),
|
||||
)
|
||||
) {
|
||||
const message = `[logs] gateway disconnected, reconnecting in ${Math.round(backoffMs / 1_000)}s...`;
|
||||
if (jsonMode) {
|
||||
if (!emitJsonLine({ type: "notice", message }, true)) {
|
||||
return;
|
||||
}
|
||||
} else if (!errorLine(colorize(rich, theme.warn, message))) {
|
||||
return;
|
||||
}
|
||||
await delay(backoffMs);
|
||||
@@ -366,6 +363,16 @@ export function registerLogsCli(program: Command) {
|
||||
process.exit(1);
|
||||
return;
|
||||
}
|
||||
if (followRetryAttempt > 0) {
|
||||
const message = "[logs] gateway reconnected";
|
||||
if (jsonMode) {
|
||||
if (!emitJsonLine({ type: "notice", message }, true)) {
|
||||
return;
|
||||
}
|
||||
} else if (!errorLine(colorize(rich, theme.muted, message))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
followRetryAttempt = 0;
|
||||
const lines = Array.isArray(payload.lines) ? payload.lines : [];
|
||||
if (jsonMode) {
|
||||
|
||||
Reference in New Issue
Block a user