Skip to content

Commit

Permalink
Merge pull request #292 from dtolnay/private
Browse files Browse the repository at this point in the history
Make private helper macro names less likely to conflict
  • Loading branch information
dtolnay authored Sep 3, 2018
2 parents 5602967 + da920f8 commit 9b30cbb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ macro_rules! log {
let lvl = $lvl;
if lvl <= $crate::STATIC_MAX_LEVEL && lvl <= $crate::max_level() {
$crate::__private_api_log(
log_format_args!($($arg)+),
__log_format_args!($($arg)+),
lvl,
&($target, log_module_path!(), log_file!(), log_line!()),
&($target, __log_module_path!(), __log_file!(), __log_line!()),
);
}
});
($lvl:expr, $($arg:tt)+) => (log!(target: log_module_path!(), $lvl, $($arg)+))
($lvl:expr, $($arg:tt)+) => (log!(target: __log_module_path!(), $lvl, $($arg)+))
}

/// Logs a message at the error level.
Expand Down Expand Up @@ -206,7 +206,7 @@ macro_rules! log_enabled {
&& $crate::__private_api_enabled(lvl, $target)
}};
($lvl:expr) => {
log_enabled!(target: log_module_path!(), $lvl)
log_enabled!(target: __log_module_path!(), $lvl)
};
}

Expand All @@ -222,31 +222,31 @@ macro_rules! log_enabled {
// local macros, and invoke format_args directly.
#[doc(hidden)]
#[macro_export]
macro_rules! log_format_args {
macro_rules! __log_format_args {
($($args:tt)*) => {
format_args!($($args)*)
};
}

#[doc(hidden)]
#[macro_export]
macro_rules! log_module_path {
macro_rules! __log_module_path {
() => {
module_path!()
};
}

#[doc(hidden)]
#[macro_export]
macro_rules! log_file {
macro_rules! __log_file {
() => {
file!()
};
}

#[doc(hidden)]
#[macro_export]
macro_rules! log_line {
macro_rules! __log_line {
() => {
line!()
};
Expand Down

0 comments on commit 9b30cbb

Please sign in to comment.