free-claude-code/messaging/safe_diagnostics.py
Alishahryar1 f3a7528d49
Some checks are pending
CI / checks (push) Waiting to run
Major refactor: API, providers, messaging, and Anthropic protocol
Consolidates the incremental refactor work into a single change set: modular web tools (api/web_tools), native Anthropic request building and SSE block policy, OpenAI conversion and error handling, provider transports and rate limiting, messaging handler and tree queue, safe logging, smoke tests, and broad test coverage.
2026-04-26 03:01:14 -07:00

17 lines
544 B
Python

"""Helpers for redacting user-derived content from log lines."""
from __future__ import annotations
def format_exception_for_log(exc: BaseException, *, log_full_message: bool) -> str:
"""Return exception type and optionally ``str(exc)`` for operator diagnostics."""
if log_full_message:
return f"{type(exc).__name__}: {exc}"
return type(exc).__name__
def text_len_hint(text: str | None) -> int:
"""Length of text for metadata-only logging (0 when missing)."""
if not text:
return 0
return len(text)