Repository: slog-rs/slog (language: rust)

Issue:
2.2.1 breaking change, references to Logger are no longer accepted by macros
This would previously work but now fails to build:
```rust
fn do_thing(log: &Logger) {
    info!(log, "Thing done!");
}
```
As a workaround this works for now:
```rust
fn do_thing(log: &Logger) {
    info!(*log, "Thing done!");
}
```


Discussion / hints:
I also just ran into this as well!
I believe I broke it in 08385b5 by using a qualified name for `$crate::Drain::is_enabled(&$l, $level)`.
This was necessary because the `Drain` trait isn't in scope and the method isn't inherent.
Fixing it is as simple as making a blanket implementation of `Drain` for all references.

Fix patch:
diff --git a/src/lib.rs b/src/lib.rs
index d9fbf300a..5c610f749 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1448,6 +1448,22 @@ pub trait Drain {
         self.map(Fuse)
     }
 }
+impl<'a, D: Drain + 'a> Drain for &'a D {
+    type Ok = D::Ok;
+    type Err = D::Err;
+    #[inline]
+    fn log(
+        &self,
+        record: &Record,
+        values: &OwnedKVList,
+    ) -> result::Result<Self::Ok, Self::Err> {
+        (**self).log(record, values)
+    }
+    #[inline]
+    fn is_enabled(&self, level: Level) -> bool {
+        (**self).is_enabled(level)
+    }
+}
 
 #[cfg(feature = "std")]
 /// `Send + Sync + UnwindSafe` bound


Test patch:
diff --git a/src/tests.rs b/src/tests.rs
index c8f87e6cb..8c4f25608 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -237,3 +237,14 @@ fn logger_to_erased() {
 
     takes_arced_drain(log.into_erased());
 }
+
+#[test]
+fn logger_by_ref() {
+    use ::*;
+    let drain = Discard.filter_level(Level::Warning).map(Fuse);
+    let log = Logger::root_typed(drain, o!("version" => env!("CARGO_PKG_VERSION")));
+    let f = "f";
+    let d = (1, 2);
+    info!(&log, "message"; "f" => %f, "d" => ?d);
+}
+