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

Issue:
Use fully qualified name of Logger::log in macros
The `log!` macro uses the `$l.log(...)` method call syntax to invoke the `Logger::log` method.
This can produce confusing compiler errors in the following situation:

1. A trait is defined that features method named `log`.
2. A generic impl is defined for the trait that, likely by accident, covers `Logger`.
3. slog macros are used in code where the trait is visible, resulting in the trait's `log` method being selected instead of the inherent method of `Logger`.

The solution is to use fully qualified method call syntax in the macros: `$crate::Logger::log($l, ...)`.


Discussion / hints:
Fine with me. Please send PR. I wonder how is this going to break stuff. :D

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e6415a4e2..ffcaac6fb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](http://keepachangelog.com/)
 and this project adheres to [Semantic Versioning](http://semver.org/).
 
+## 2.5.3 - ????-??-??
+
+* Use fully qualified call syntax for `Logger::log` in macros
+
 ## 2.5.2 - 2019-07-22
 
 * Restored parsing of `Level` and `FilterLevel` truncated names
diff --git a/src/lib.rs b/src/lib.rs
index f645b90a0..66f2e98c1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -723,7 +723,7 @@ macro_rules! slog_record(
 macro_rules! log(
     // `2` means that `;` was already found
    (2 @ { $($fmt:tt)* }, { $($kv:tt)* },  $l:expr, $lvl:expr, $tag:expr, $msg_fmt:expr) => {
-      $l.log(&record!($lvl, $tag, &__slog_builtin!(@format_args $msg_fmt, $($fmt)*), b!($($kv)*)))
+      $crate::Logger::log(&$l, &record!($lvl, $tag, &__slog_builtin!(@format_args $msg_fmt, $($fmt)*), b!($($kv)*)))
    };
    (2 @ { $($fmt:tt)* }, { $($kv:tt)* }, $l:expr, $lvl:expr, $tag:expr, $msg_fmt:expr,) => {
        log!(2 @ { $($fmt)* }, { $($kv)* }, $l, $lvl, $tag, $msg_fmt)
@@ -796,7 +796,7 @@ macro_rules! log(
 macro_rules! slog_log(
     // `2` means that `;` was already found
    (2 @ { $($fmt:tt)* }, { $($kv:tt)* },  $l:expr, $lvl:expr, $tag:expr, $msg_fmt:expr) => {
-      $l.log(&slog_record!($lvl, $tag, &__slog_builtin!(@format_args $msg_fmt, $($fmt)*), slog_b!($($kv)*)))
+      $crate::Logger::log(&$l, &slog_record!($lvl, $tag, &__slog_builtin!(@format_args $msg_fmt, $($fmt)*), slog_b!($($kv)*)))
    };
    (2 @ { $($fmt:tt)* }, { $($kv:tt)* }, $l:expr, $lvl:expr, $tag:expr, $msg_fmt:expr,) => {
        slog_log!(2 @ { $($fmt)* }, { $($kv)* }, $l, $lvl, $tag, $msg_fmt)


Test patch: