Crates.io | errlog |
lib.rs | errlog |
version | 0.0.2 |
source | src |
created_at | 2021-09-19 03:58:40.290433 |
updated_at | 2021-09-19 04:10:07.112803 |
description | A simple error logger based on anyhow |
homepage | |
repository | https://github.com/ikey4u/errlog |
max_upload_size | |
id | 453482 |
size | 2,046 |
errlog is a simple log library based on anyhow, it wraps file name and line number for your error message.
Add the errlog dependencies into your Cargo.toml, then import errlog macro
use errlog::{elog, AnyContext, AnyResult};
Now you can use it in function that return AnyResult<xxx>
such as
return Err(elog!("Unkown file type"));
or
File:open(filepath).context(elog!("Cannot open file {}", filepath))?;