debug_error
A lightweight error handling library for Rust that automatically captures file and line information, making debugging significantly easier.
Features
- 📍 Automatic Location Tracking - Errors automatically capture file and line numbers
- 📝 Flexible Logging - Choose between automatic logging or manual control
- 🔧 Seamless Integration - Works perfectly with Rust's
?
operator - 🚀 High compatibility - Compatible with any logger that implements the
log
crate interface - 📦 Lightweight - Minimal performance overhead
Example output
: This is a test error without automatic logging at examples\basic_usage.rs:37:15
Error: This error is automatically logged at examples\basic_usage.rs:48:5
Created error
Example usage
use ;
use info;
Notes
- More Examples:
- examples/basic_usage.rs
- examples/real_world_scenario.rs
- How to use:
- Use the "debug_error_with_log" macro during development - no need for error handling infrastructure yet.
- Replace "debug_error_with_log" macro with "debug_error" - for production and when error handling infrastructure is set up.
Installation
Add to your Cargo.toml
:
[]
= "0.1"
= "0.4" # Required for logging functionality