Skip to content

Commit

Permalink
Document the logging feature. (#374)
Browse files Browse the repository at this point in the history
* Document the `logging` feature.

Fixes #362.

* add "text" so cargo doesn't try to compile it

---------

Co-authored-by: Emmanuel Thompson <[email protected]>
  • Loading branch information
vext01 and sharksforarms authored Nov 16, 2023
1 parent 4e8849f commit d1827d1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,28 @@ pub struct EncodedString {
}
```
# Debugging decoders with the `logging` feature.
If you are having trouble understanding what causes a Deku parse error, you may find the `logging`
feature useful.
To use it, you will need to:
- enable the `logging` Cargo feature for your Deku dependency
- import the `log` crate and a compatible logging library
For example, to log with `env_logger`, the dependencies in your `Cargo.toml` might look like:
```text
deku = { version = "*", features = ["logging"] }
log = "*"
env_logger = "*"
```
Then you'd call `env_logger::init()` or `env_logger::try_init()` prior to doing Deku decoding.
Deku uses the `trace` logging level, so if you run your application with `RUST_LOG=trace` in your
environment, you will see logging messages as Deku does its deserialising.
*/
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
Expand Down

0 comments on commit d1827d1

Please sign in to comment.