Skip to content

Commit

Permalink
Log module_path to target under std (paritytech#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchengxu authored Aug 11, 2020
1 parent c3430f6 commit 9acc737
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion xpallets/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ decl_module! {
let params = (origin.clone(), value).encode();

if let Err(_e) = Self::call_for_xrc20(id, XRC20Selector::Issue, params.clone()) {
error!("[force_issue_xrc20]|{:?}|who:{:?}|value:{:?}|params:{:?}", _e.reason, origin, value, try_hex!(&params))
error!("[force_issue_xrc20]|{:?}|who:{:?}|value:{:?}|params:{:?}", _e.reason, origin, value, try_hex!(&params));
}
}
Ok(())
Expand Down
15 changes: 15 additions & 0 deletions xpallets/support/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ pub mod log {
frame_support::debug::error!(target: $target, $($arg)+);
);
($($arg:tt)+) => (
#[cfg(feature = "std")]
$crate::error!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
#[cfg(not(feature = "std"))]
$crate::error!(target: "runtime", $($arg)+);
)
}
Expand All @@ -95,6 +98,9 @@ pub mod log {
frame_support::debug::warn!(target: $target, $($arg)+);
);
($($arg:tt)+) => (
#[cfg(feature = "std")]
$crate::warn!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
#[cfg(not(feature = "std"))]
$crate::warn!(target: "runtime", $($arg)+);
)
}
Expand All @@ -105,6 +111,9 @@ pub mod log {
frame_support::debug::info!(target: $target, $($arg)+);
);
($($arg:tt)+) => (
#[cfg(feature = "std")]
$crate::info!(target: &format!("runtime::{}", module_path!()), $($arg)+);
#[cfg(not(feature = "std"))]
$crate::info!(target: "runtime", $($arg)+);
)
}
Expand All @@ -115,6 +124,9 @@ pub mod log {
frame_support::debug::debug!(target: $target, $($arg)+);
);
($($arg:tt)+) => (
#[cfg(feature = "std")]
$crate::debug!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
#[cfg(not(feature = "std"))]
$crate::debug!(target: "runtime", $($arg)+);
)
}
Expand All @@ -125,6 +137,9 @@ pub mod log {
frame_support::debug::trace!(target: $target, $($arg)+);
);
($($arg:tt)+) => (
#[cfg(feature = "std")]
$crate::trace!(target: &format!("runtime::{}:{}", module_path!(), line!()), $($arg)+);
#[cfg(not(feature = "std"))]
$crate::trace!(target: "runtime", $($arg)+);
)
}
Expand Down

0 comments on commit 9acc737

Please sign in to comment.