slog-rs / slog

Structured, contextual, extensible, composable logging for Rust
https://slog.rs/
Apache License 2.0
1.58k stars 95 forks source link

Serde struct not available #325

Closed Paul-E closed 1 year ago

Paul-E commented 1 year ago

I'm having trouble with importing a struct that is behind a feature flag.

I'm trying to use the Serde unit struct in order to log things that are serde serializable. The problem is, I can't seem to import the Serde struct, even with the nested-values feature enabled.

I get the error

error[E0425]: cannot find function, tuple struct or tuple variant `Serde` in crate `slog`
  --> src/main.rs:44:42
   |
44 |     info!(log, "test"; "output" => slog::Serde(output));
   |                                          ^^^^^ not found in `slog`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `slog-serde-example` (bin "slog-serde-example") due to previous error

You can see an example here https://github.com/Paul-E/slog-serde-example

I'm able to import/see the SerdeValue, which is also behind the nested-values flag, so something else is going on. Additionally, the fact that the struct doesn't show up in the generated docs makes me thinks something is going on in the slog crate.

Paul-E commented 1 year ago

Ah, looks like that struct goes out in 2.8