3 unstable releases
Uses new Rust 2024
new 0.2.1 | Apr 12, 2025 |
---|---|
0.2.0 | Apr 12, 2025 |
0.1.0 | Apr 12, 2025 |
#97 in #information
7KB
100 lines
Sayaka
Sayaka is a lightweight Rust debugging toolkit that provides concise and practical macros to assist in development debugging.
Features
- Colored formatted debug output
- Configurable debug information display
- Easy-to-use macros for printing variables and function call information
Installation
Add the dependency to your Cargo.toml
:
[dependencies]
sayaka = "0.2.0"
or use the cargo command in you commandline.
cargo add sayaka
Usage
Basic Usage
use sayaka::{debugln, debug_var, debug_fn};
fn main() {
let name = "world";
// Print simple debug information
debugln!("Hello, {}!", name);
// Print variable value and type
debug_var!(name);
// Track function calls and their parameters
my_function(42);
}
fn my_function(value: i32) {
debug_fn!(value);
// Function body...
}
Environment Variables
Sayaka can be configured through two environment variables:
SAYAKA_DEBUG
: Set to a non-zero value to enable debug outputSAYAKA_NO_COLOR
: Set to a non-zero value to disable colored output
Examples:
# Enable debug output
SAYAKA_DEBUG=1 cargo run
# Enable debug but disable colored output
SAYAKA_DEBUG=1 SAYAKA_NO_COLOR=1 cargo run
API Reference
Macros
debugln!($fmt, ...)
: Prints debug information, similar toprintln!
formatdebug_var!($var1, $var2, ...)
: Prints detailed information about one or more variablesdebug_fn!($arg1, $arg2, ...)
: Prints current function name and its parameters
License
MIT
Dependencies
~1–7.5MB
~51K SLoC