slog icon indicating copy to clipboard operation
slog copied to clipboard

StdLog missing examples of correct usage

Open kornelski opened this issue 5 years ago • 3 comments

The documentation:

https://docs.rs/slog-stdlog/3.0.4-pre/slog_stdlog/struct.StdLog.html

lacks any examples. And a working example is very much necessary, because straightforward usage doesn't work and produces incomprehensible error. StdLog implements Drain, but one that is incompatible with slog::Logger:

39 |     let log = slog::Logger::root(slog_stdlog::StdLog, slog::o!());
   |               ^^^^^^^^^^^^^^^^^^ expected struct `std::io::Error`, found struct `slog::private::NeverStruct`
   |
   = note: expected type `std::io::Error`
              found type `slog::private::NeverStruct`
   = note: required by `slog::Logger::<D>::root`

I've tried calling .fuse(), but it doesn't change error type to slog::private::NeverStruct, just passes the same error type through.

kornelski avatar Mar 17 '19 19:03 kornelski

.fuse() should work. https://docs.rs/slog/2.4.1/slog/struct.Fuse.html type Error = Never, no matter what's the wrapped type. The implementation: https://docs.rs/slog/2.4.1/src/slog/lib.rs.html#1902-1922 .

Are you sure it didn't?

dpc avatar Mar 18 '19 23:03 dpc

Could you add examples please? :)

j-w-shin avatar Jul 11 '19 19:07 j-w-shin

PRs are always welcome

dpc avatar Jul 11 '19 19:07 dpc