slog_unwraps
Syntactic sugar to slog an error before unwrapping. It will add caller file and line information to the log statement, but that only makes sense in debug mode. In release mode this information will either be missing or unreliable.
Anyways, this is meant to make your life easier while developping. It will also report file and line number of the unwraps so you don't have to turn on RUST_BACKTRACE to see what went wrong.
At first I had an expects
function as well to be able to add context, but I really think you should use the
failure
crate, which provides a context
method on errors, which is cleaner, so expects
no longer exists. If you don't want to use failure
, you will have to make sure your errors display sensible messages.
Example
run with cargo run --example basic
use
;