Crates.io | log-termination |
lib.rs | log-termination |
version | 0.1.0 |
source | src |
created_at | 2019-12-17 15:08:19.504321 |
updated_at | 2019-12-17 15:08:19.504321 |
description | A proc macro which wraps fn main() in a Termination newtype and sends the error to log::error! |
homepage | |
repository | https://github.com/interruptinuse/log-termination |
max_upload_size | |
id | 190020 |
size | 44,467 |
Provides an attribute proc macro for your fn main() -> Result<(), Box<dyn Error>>
which sends returned errors to log::error!
.
#![feature(try_trait)]
#![feature(termination_trait_lib)]
use log_termination::log_termination;
#[log_termination]
fn main() -> Result<(), Box<dyn std::error::Error>> {
// set up logging, e.g. fern
std::fs::metadata("non-existing-file")?;
// will call log::error!("No such file or directory (os error 2)") before exiting
}