We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use slog::Drain; // required to call .fuse() on logger let log: Arc<slog::Logger> = log; slog::error!(log, "WTF");
Gives:
| 115 | slog::error!(log, "WTF"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `std::result::Result` | = note: expected type `()` found type `std::result::Result<(), slog::private::NeverStruct>`
This is because log.log() finds <log as Drain>::log() rather than <log as Logger>::log().
log.log()
<log as Drain>::log()
<log as Logger>::log()
This compiles:
let log: &slog::Logger = &log; slog::error!(log, "WTF");
but it's PITA, because I have to use Arc to share the logger in my application, and typecasting before every use of the macros kills the convenience.
Arc
The best thing would be for log!() expansion to do let log: &slog::Logger = &log; itself instead of expecting log.log() to do that implicitly.
log!()
let log: &slog::Logger = &log;
The text was updated successfully, but these errors were encountered:
Or alternatively, have log!() call slog::Logger::log(&log, ...)
slog::Logger::log(&log, ...)
Sorry, something went wrong.
I have to use Arc to share the logger in my application
Logger is basically a wrapper over Arc, so that's weird.
Logger
I think it's a good idea anywa, please PR. :)
No branches or pull requests
Gives:
This is because
log.log()
finds<log as Drain>::log()
rather than<log as Logger>::log()
.This compiles:
but it's PITA, because I have to use
Arc
to share the logger in my application, and typecasting before every use of the macros kills the convenience.The best thing would be for
log!()
expansion to dolet log: &slog::Logger = &log;
itself instead of expectinglog.log()
to do that implicitly.The text was updated successfully, but these errors were encountered: