Skip to content

Commit

Permalink
more README tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jgallagher committed Dec 15, 2023
1 parent 69c0bd3 commit 0b77126
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
## Overview

`slog-error-chain` provides `Display` and `slog::Value` adapters to report
the full chain of error causes from `std::error::Error`s.
`slog-error-chain` provides `std::fmt::Display`, `slog::KV`, and `slog::Value`
adapters to report the full chain of error causes from `std::error::Error`s, and
a proc macro to derive `slog::KV` and `slog::Value` implementations for error
types which will log the full chain of error causes.

This crate was born out of a use of `thiserror` to derive `std::error::Error`
implementations on error enums, although it does not depend on `thiserror` and
Expand Down Expand Up @@ -71,10 +73,10 @@ enum MyError {

let err = MyError::OpeningFile { .. };

// explicit key, logs the full chain
// explicit key; logs the full chain
info!(log, "something happened"; "my-key" => &err);

// key omitted; will log the full chain with the key "error"
// implicit key; logs the full chain with the key "error"
info!(log, "something happened"; &err);
```

Expand All @@ -96,7 +98,7 @@ enum MyError {
}
```

Doing so will make the `Display` implementation of `MyError` _look_ correct:
Doing so will make the `Display` implementation of `MyError` _look_ reasonable:

```text
# println!("{my_error}")
Expand Down

0 comments on commit 0b77126

Please sign in to comment.