Crates.io | backtraceio |
lib.rs | backtraceio |
version | 0.2.0 |
source | src |
created_at | 2022-03-16 20:31:24.959248 |
updated_at | 2022-03-16 20:31:24.959248 |
description | Backtrace I/O error reporting for Rust applications |
homepage | https://backtrace.io/ |
repository | https://github.com/backtrace-labs/backtrace-rust/ |
max_upload_size | |
id | 551427 |
size | 34,395 |
[dependencies]
backtraceio = "0.1"
Pass your custom token and upload url from your Backtrace account and a report
modification closure/function to the backtraceio::register_error_handler
function.
backtraceio::register_error_handler(
"https://UNIVERSE.sp.backtrace.io:6098",
"YOURTOKEN",
closure
);
Report
modification functionThe error handler will pass the Report
and std::panic::PanicInfo
objects
back to the user, in case there are additional attributes/annotations to be
defined (described more in detail here). It should accept &mut Report
,
&PanicInfo
, making any changes desired to the report.
use backtraceio::Report;
fn main() {
backtraceio::register_error_handler(
"https://UNIVERSE.sp.backtrace.io:6098",
"YOUR_TOKEN",
|r: &mut Report, _| {
let cpus = num_cpus::get();
let cpus = cpus.to_string();
r.attributes.insert(String::from("cpu.cores"), cpus);
},
);
println!("Hello, world!");
panic!("{:?}", 69);
}