log-termination

Crates.iolog-termination
lib.rslog-termination
version0.1.0
sourcesrc
created_at2019-12-17 15:08:19.504321
updated_at2019-12-17 15:08:19.504321
descriptionA proc macro which wraps fn main() in a Termination newtype and sends the error to log::error!
homepage
repositoryhttps://github.com/interruptinuse/log-termination
max_upload_size
id190020
size44,467
∂ω∂ (interruptinuse)

documentation

README

log-termination

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
}
Commit count: 0

cargo fmt