Skip to content

feat: replace println with tracing framework#52

Open
echobt wants to merge 1 commit intomainfrom
fix/issue-164
Open

feat: replace println with tracing framework#52
echobt wants to merge 1 commit intomainfrom
fix/issue-164

Conversation

@echobt
Copy link
Copy Markdown
Contributor

@echobt echobt commented Jan 20, 2026

This PR replaces the usage of println! for diagnostic output with the tracing framework. It introduces structured logging capabilities, allowing users to control log levels and output destinations.

Changes

  • Added tracing, tracing-subscriber, and tracing-appender dependencies.
  • Implemented logging initialization in src/logging.rs.
  • Replaced println! calls with info! and warn! macros in src/core/indexer.rs, src/watcher.rs, and src/server/api.rs.
  • Added --log-level and --log-file CLI arguments to control logging behavior.
  • Preserved UI-related println! calls (e.g., prompts, progress bars, search results) to maintain user interaction.

Benefits

  • Configurable Log Levels: Users can specify the verbosity of logs (error, warn, info, debug, trace).
  • File Logging: Logs can be directed to a file for persistent storage and analysis.
  • Structured Logging: Provides a foundation for machine-readable logs and integration with observability tools.
  • Production Debugging: Facilitates easier debugging in production environments by enabling detailed logging without cluttering stdout.

- Add tracing, tracing-subscriber, and tracing-appender dependencies
- Implement logging initialization in src/logging.rs
- Replace diagnostic println! calls with info! and warn! macros in core components
- Add --log-level and --log-file CLI arguments
- Preserve UI/interactive println! calls (prompts, progress bars, search results)
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