support field values in err! macro

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-08-01 08:41:47 +00:00
parent 5b1642f641
commit 5add9a8c34
4 changed files with 127 additions and 31 deletions

View file

@ -14,7 +14,7 @@ pub use crate::utils::debug::*;
#[macro_export]
macro_rules! debug_event {
( $level:expr, $($x:tt)+ ) => {
if cfg!(debug_assertions) && cfg!(not(feature = "dev_release_log_level")) {
if $crate::debug::logging() {
::tracing::event!( $level, $($x)+ )
} else {
::tracing::debug!( $($x)+ )
@ -88,3 +88,7 @@ pub fn panic_str(p: &Box<dyn Any + Send>) -> &'static str { p.downcast_ref::<&st
#[inline(always)]
#[must_use]
pub fn type_name<T>(_: &T) -> &'static str { std::any::type_name::<T>() }
#[must_use]
#[inline]
pub const fn logging() -> bool { cfg!(debug_assertions) && cfg!(not(feature = "dev_release_log_level")) }