breadcrumbs
Breadcrumbs is a beautiful, tiny traceback and logging library for Rust that offers seamless integration with #![no_std], multi-threading and concurrency.
Features
- Beautifully-formatted traceback of logs (supporting
DisplayandDebug) - Dynamic log levels
- Dynamic log channels
- Seamless integration with
#![no_std] - Multi-threading and concurrent logging supported with no special syntax
- Easy-to-use macros
- Support for listeners to be notified of new logs
Usage
Add the following to your Cargo.toml:
[]
= "0.1.5"
Then, initalize breadcrumbs once in your main.rs or lib.rs:
use init;
init!;
You can set a custom log listener with ease by implementing the LogListener trait:
use ;
;
init!;
Then, simply use the log! macro from or its variants from anywhere to log messages:
use ;
// A basic log message
log!;
// A log message with a custom level
log_level!;
// A log message with a custom channel
log_channel!;
// A log message with a custom channel and level
log!;
Access a traceback of log messages from anywhere with the traceback! macro or its variants:
use ;
// A basic traceback, fetching all logged messages
let t = traceback!;
// A traceback with a custom channel, fetching messages in this channel
let t = traceback_channel!;
// A traceback with a custom level, fetching messages of this level or higher
let traceback = traceback_level!;
// A traceback with a custom channel and level, fetching messages in this channel of this level or higher
let traceback = traceback!;
Traceback and Log objects beautifully implement Display and Debug:
use traceback;
let t = traceback!;
println!;
println!;
Example
use ;
;