Skip to content

refactor: use module-scoped loggers instead of the root logger - #195

Merged
frostming merged 1 commit into
mainfrom
refactor/scoped-logger
Nov 12, 2026
Merged

frostming merged 1 commit into
mainfrom
refactor/scoped-logger

Conversation

@frostming

Copy link
Copy Markdown
Contributor

Summary

Library modules previously called logging.exception(...), logging.debug(...), etc. directly, which emits records on the root logger. This makes it impossible for applications to tune or silence ACP's logging without affecting everything else.

Each module now defines _logger = logging.getLogger(__name__) and logs through it, so records are emitted under the acp.* namespace (e.g. acp.connection, acp.task.supervisor, acp.ws.server) and can be configured via logging.getLogger("acp").

Touched modules:

  • src/acp/connection.py
  • src/acp/stdio.py
  • src/acp/task/supervisor.py
  • src/acp/ws/server.py

Examples (examples/agent.py, examples/client.py) are left unchanged since they are standalone scripts that configure root logging themselves.

No behavioral change other than the logger name on emitted records; messages and levels are unchanged.

Testing

  • make check: ruff, format, types, deptry all pass
  • uv run python -m pytest: 540 passed, 1 skipped (the existing caplog-based tests in tests/test_request_error_logging.py still pass since caplog captures propagated records)

🤖 Generated with Claude Code

Replace bare logging.* calls in the library with a per-module
`_logger = logging.getLogger(__name__)` so records are emitted under the
`acp.*` namespace and can be configured or silenced by applications.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@frostming
frostming merged commit da202e0 into main Nov 12, 2026
8 checks passed
@frostming
frostming deleted the refactor/scoped-logger branch November 12, 2026 02:08
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