breadcrumbs
Breadcrumbs is a beautiful, dynamic traceback and logging library for Rust that offers seamless integration with #![no_std], multi-threading and concurrency.
Features
-
#![no_std]support - Multi-threading and concurrency support
- Live streaming of logs
- Customisable log handling
- Varied logging levels
- Customisable logging 'channels'
- Out-of-the-box traceback and log formatting
Usage
Add the following to your Cargo.toml:
[]
= "0.1.0"
Then, initalize breadcrumbs once in your main.rs or lib.rs:
use init;
init;
You can set a custom log handler with ease by implementing the LogHandler trait:
use ;
;
init_with_handler;
Then, simply use the log! macro or its variants 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!;
Example
use ;
!