Problem
Golem currently uses println!/eprintln! for all output — user-facing messages, debug info, warnings, and errors are all mixed together with no log levels, timestamps, or filtering.
Proposed solution
Add structured logging via the tracing crate (or log + env_logger for simplicity).
What to log
| Level |
Examples |
error |
API failures, auth errors, tool execution failures |
warn |
Parse retries, deprecated features, fallback behavior |
info |
Model changes, login/logout, tool execution summaries |
debug |
Full API request/response bodies, ReAct loop iterations, memory operations |
trace |
Raw HTTP headers, token refresh flow, config reads |
Configuration
Implementation
- Add
tracing + tracing-subscriber dependencies
- Replace
eprintln!("warning: ...") with tracing::warn!()
- Add structured fields to log events (provider, model, iteration, tool name)
- Keep user-facing output (
println!) separate from logs
- Logs go to stderr, user output to stdout
Relates to
Problem
Golem currently uses
println!/eprintln!for all output — user-facing messages, debug info, warnings, and errors are all mixed together with no log levels, timestamps, or filtering.Proposed solution
Add structured logging via the
tracingcrate (orlog+env_loggerfor simplicity).What to log
errorwarninfodebugtraceConfiguration
warnlevel (quiet for normal use)--verbose/-vflag:infolevel--debugflag orGOLEM_LOG=debugenv var:debuglevel/debugslash command to toggle at runtime (feat: add debug mode to show raw LLM request/response data #38)Implementation
tracing+tracing-subscriberdependencieseprintln!("warning: ...")withtracing::warn!()println!) separate from logsRelates to