[GH-ISSUE #8] Add structured logging with log levels across all layers #6

Closed
opened 2026-10-15 18:19:49 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @morluto on GitHub (Jul 12, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/8

Motivation

REA currently has no logging infrastructure (pino, winston, etc.). Adding structured logging would improve debuggability of MCP sessions, bridge communication, and CLI operations. It also enables log scrubbing and observability integrations down the line.

Proposed Changes

  1. Add pino (lightweight, fast structured JSON logger) as a dependency
  2. Create src/logger.ts with:
    • Log level configuration (trace/debug/info/warn/error/fatal)
    • Per-layer child loggers with context (server, bridge, cli, domain)
    • Redacted sensitive data support
  3. Integrate logging into:
    • Bridge client request/response cycles (with timing)
    • MCP tool execution (tool name, duration, result status)
    • CLI one-shot commands
    • Error boundaries
  4. Output to stderr in MCP mode (per MCP spec) and stdout in CLI mode

Acceptance Criteria

  • All layers have structured log output in JSON format
  • Log level is configurable via environment variable
  • MCP mode logs to stderr without interfering with stdio transport
  • Bridge request/response timing is logged
  • No secrets or sensitive data in log output
Originally created by @morluto on GitHub (Jul 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/8 ## Motivation REA currently has no logging infrastructure (`pino`, `winston`, etc.). Adding structured logging would improve debuggability of MCP sessions, bridge communication, and CLI operations. It also enables log scrubbing and observability integrations down the line. ## Proposed Changes 1. Add `pino` (lightweight, fast structured JSON logger) as a dependency 2. Create `src/logger.ts` with: - Log level configuration (trace/debug/info/warn/error/fatal) - Per-layer child loggers with context (server, bridge, cli, domain) - Redacted sensitive data support 3. Integrate logging into: - Bridge client request/response cycles (with timing) - MCP tool execution (tool name, duration, result status) - CLI one-shot commands - Error boundaries 4. Output to stderr in MCP mode (per MCP spec) and stdout in CLI mode ## Acceptance Criteria - [ ] All layers have structured log output in JSON format - [ ] Log level is configurable via environment variable - [ ] MCP mode logs to stderr without interfering with stdio transport - [ ] Bridge request/response timing is logged - [ ] No secrets or sensitive data in log output
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6
No description provided.