diff --git a/src/__private_api.rs b/src/__private_api.rs index 09e7a7ed6..20a7c8770 100644 --- a/src/__private_api.rs +++ b/src/__private_api.rs @@ -54,12 +54,15 @@ impl Log for GlobalLogger { } } -// Split from `log` to reduce generics and code size +// Split from `log` to reduce generics and code size. +// Being generic over the logger, it gets inlined into callsites without the attribute +#[inline(never)] fn log_impl( logger: L, args: Arguments, level: Level, - &(target, module_path, loc): &(&str, &'static str, &'static Location), + &(target, module_path): &(&str, &'static str), + loc: &'static Location, kvs: Option<&[(Key, Value)]>, ) { #[cfg(not(feature = "kv"))] @@ -87,7 +90,8 @@ pub fn log<'a, K, L>( logger: L, args: Arguments, level: Level, - target_module_path_and_loc: &(&str, &'static str, &'static Location), + target_and_module_path: &(&str, &'static str), + loc: &'static Location, kvs: K, ) where K: KVs<'a>, @@ -97,7 +101,8 @@ pub fn log<'a, K, L>( logger, args, level, - target_module_path_and_loc, + target_and_module_path, + loc, kvs.into_kvs(), ) } diff --git a/src/macros.rs b/src/macros.rs index 1e766997b..bef7f45d7 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -125,7 +125,8 @@ macro_rules! __log { $logger, $crate::__private_api::format_args!($($arg)+), lvl, - &($target, $crate::__private_api::module_path!(), $crate::__private_api::loc()), + &($target, $crate::__private_api::module_path!()), + $crate::__private_api::loc(), &[$(($crate::__log_key!($key), $crate::__log_value!($key $(:$capture)* = $($value)*))),+] as &[_], ); } @@ -139,7 +140,8 @@ macro_rules! __log { $logger, $crate::__private_api::format_args!($($arg)+), lvl, - &($target, $crate::__private_api::module_path!(), $crate::__private_api::loc()), + &($target, $crate::__private_api::module_path!()), + $crate::__private_api::loc(), (), ); }