Skip to content

refactor(logging): simplified prints and add spinner#37

Merged
yxlao merged 8 commits into
mainfrom
yixing/logging-simplified
May 4, 2026
Merged

refactor(logging): simplified prints and add spinner#37
yxlao merged 8 commits into
mainfrom
yixing/logging-simplified

Conversation

@yxlao
Copy link
Copy Markdown
Owner

@yxlao yxlao commented May 4, 2026

TLDR

Displays spinner while streaming:

┌ request model=deepseek-v4-pro effort=max messages=167
├ context status=ok reasoning=57
└ ⠹

When done:

┌ request model=deepseek-v4-pro effort=max messages=167
├ context status=ok reasoning=57
└ stats   prompt=46,091 output=283 reasoning=59 cache_hit=99.4%

Summary

Extract logging utilities into a dedicated module, add a terminal spinner for streaming requests, and simplify both startup and per-request log output.

Changes Made

  • New file src/deepseek_cursor_proxy/logging.py:
    • ConsoleLogFormatter — custom formatter that hides timestamps/level prefixes in normal mode and shows full detail in verbose mode
    • configure_logging() — sets up a StreamHandler with the appropriate formatter
    • TerminalSpinner — animated spinner (Braille frames) for tty streams during streaming requests
  • server.py:
    • Replaced inline logging usage with from .logging import LOG, TerminalSpinner, configure_logging
    • Added TerminalSpinner lifecycle around streaming upstream requests (start before forwarding, stop on completion/error/disconnect)
    • Simplified startup logging: collapsed multiple LOG.info calls into concise key-value pairs, conditional on verbose mode
    • Removed tool_count from request log line; renamed ┌ cursor to ┌ request; simplified log_context_summary status output
    • Moved log_send_summary behind verbose gating
  • transform.py and tunnel.py:
    • Replaced import logging + LOG = logging.getLogger(...) with from .logging import LOG
  • tests/test_server.py:
    • Added unit tests for ConsoleLogFormatter (info/warning formatting, verbose timestamp) and TerminalSpinner (tty vs non-tty behavior)
    • Updated integration test assertions to match new log message format

@yxlao yxlao changed the title refactor(logging): extract module and add spinner refactor(logging): simplified prints and add spinner May 4, 2026
@yxlao yxlao merged commit a35583a into main May 4, 2026
6 checks passed
@yxlao yxlao deleted the yixing/logging-simplified branch May 4, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant