log-termination 0.1.0

A proc macro which wraps fn main() in a Termination newtype and sends the error to log::error!
Documentation

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
}