From 3985711f74bb75a6504c41f6f4b66ad5fd29ef41 Mon Sep 17 00:00:00 2001 From: EFanZh Date: Sun, 6 Aug 2023 18:54:26 +0800 Subject: [PATCH] Group `target`, `module_path` and `file` arguments --- src/__private_api.rs | 6 ++++-- src/macros.rs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/__private_api.rs b/src/__private_api.rs index e89c07b5c..7304deb89 100644 --- a/src/__private_api.rs +++ b/src/__private_api.rs @@ -9,7 +9,8 @@ pub use std::{file, format_args, line, module_path, stringify}; pub fn log( args: Arguments, level: Level, - &(target, module_path, file, line): &(&str, &'static str, &'static str, u32), + &(target, module_path, file): &(&str, &'static str, &'static str), + line: u32, kvs: Option<&[(&str, &str)]>, ) { if kvs.is_some() { @@ -34,7 +35,8 @@ pub fn log( pub fn log( args: Arguments, level: Level, - &(target, module_path, file, line): &(&str, &'static str, &'static str, u32), + &(target, module_path, file): &(&str, &'static str, &'static str), + line: u32, kvs: Option<&[(&str, &dyn crate::kv::ToValue)]>, ) { crate::logger().log( diff --git a/src/macros.rs b/src/macros.rs index 308682b6b..281ff2572 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -36,7 +36,8 @@ macro_rules! log { $crate::__private_api::log( $crate::__private_api::format_args!($($arg)+), lvl, - &($target, $crate::__private_api::module_path!(), $crate::__private_api::file!(), $crate::__private_api::line!()), + &($target, $crate::__private_api::module_path!(), $crate::__private_api::file!()), + $crate::__private_api::line!(), $crate::__private_api::Option::Some(&[$(($crate::__log_key!($key), &$value)),+]) ); } @@ -49,7 +50,8 @@ macro_rules! log { $crate::__private_api::log( $crate::__private_api::format_args!($($arg)+), lvl, - &($target, $crate::__private_api::module_path!(), $crate::__private_api::file!(), $crate::__private_api::line!()), + &($target, $crate::__private_api::module_path!(), $crate::__private_api::file!()), + $crate::__private_api::line!(), $crate::__private_api::Option::None, ); }