From c06a3dcf5642adb4bcff4780c2047bb128e28de4 Mon Sep 17 00:00:00 2001 From: unclecode Date: Fri, 17 Apr 2026 04:17:06 +0000 Subject: [PATCH] fix(logger): default Console width=200 for non-TTY contexts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rich's Console() falls back to width=80 when stdout isn't a TTY (Docker container logs, CI, captured output). That truncates diagnostic lines that carry structured fields like "[ANTIBOT] tier N/M proxy=... status= validator=... reason=..." — exactly the information you want when debugging anti-bot escalation from logs alone. Setting width=200 only affects the non-TTY fallback; real terminals still auto-detect their actual width. Pure ergonomics improvement for cloud/container deployments where everyone reads logs via `docker logs` or log aggregators rather than interactively. (cherry picked from commit 398851562ca102d73f979d7ceab589079817cc0d) --- crawl4ai/async_logger.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crawl4ai/async_logger.py b/crawl4ai/async_logger.py index 8edcb24a..a4697315 100644 --- a/crawl4ai/async_logger.py +++ b/crawl4ai/async_logger.py @@ -144,7 +144,11 @@ class AsyncLogger(AsyncLoggerBase): self.verbose = verbose # Default to stderr so log lines do not corrupt stdout-based protocols # (e.g. MCP stdio transport, piped shell commands). - self.console = console if console is not None else Console(stderr=True) + # width=200: Rich's default falls back to 80 in non-TTY contexts + # (e.g. Docker `docker logs`, CI, captured stdout), which truncates + # useful diagnostic lines. TTYs still auto-detect actual terminal + # width; this only lifts the non-TTY fallback cap. + self.console = console if console is not None else Console(stderr=True, width=200) # Create log file directory if needed if log_file: