Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 3, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Below are some instructions on how I'd like to add logging support using the Rust log crate. I'd like to start with just adding logging to ruwind/elf.rs and see these rules in practice. From there we may change the rules and then ultimately add logging elsewhere within the project.

Tasks:

  1. Add log = "0.4" dependency to the appropriate Cargo.toml
  2. Import log macros: use log::{error, warn, info, debug, trace};
  3. Add logging following these rules:

Log Levels:

  • ERROR: Fatal issues, data corruption, failed critical operations
  • WARN: Recoverable errors, missing optional features, fallback behavior
  • INFO: Major lifecycle events, initialization, shutdown, state transitions
  • DEBUG: Operational details, lookups, calculations, file I/O
  • TRACE: Fine-grained execution, per-entry parsing, tight loops

Where to Log:

  • Public function entry (DEBUG): debug!("Function called: param={}", value);
  • Error creation sites (ERROR/WARN): error!("Operation failed: reason={}, context={}", reason, ctx);
  • State changes (INFO): info!("State changed: old={}, new={}", old, new);
  • File I/O (DEBUG): debug!("Reading file: path={}, offset={:#x}", path, offset);

Format:

  • Include context: IDs, offsets, sizes, names, indices
  • Use key=value format
  • Be specific and actionable

Avoid:

  • Logging in tight loops at INFO or higher
  • Logging successful operations at INFO (use DEBUG)
  • Vague messages without context

Log at error creation points only, not at every ? propagation.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

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.

2 participants