Jelajahi Sumber

show log in testing

Dean Li 3 tahun lalu
induk
melakukan
275b8aca43
1 mengubah file dengan 8 tambahan dan 0 penghapusan
  1. 8 0
      src/macros.rs

+ 8 - 0
src/macros.rs

@@ -1,9 +1,17 @@
+#[cfg(not(test))]
 #[cfg(feature = "log")]
 macro_rules! net_log {
     (trace, $($arg:expr),*) => { log::trace!($($arg),*) };
     (debug, $($arg:expr),*) => { log::debug!($($arg),*) };
 }
 
+#[cfg(test)]
+#[cfg(feature = "log")]
+macro_rules! net_log {
+    (trace, $($arg:expr),*) => { println!($($arg),*) };
+    (debug, $($arg:expr),*) => { println!($($arg),*) };
+}
+
 #[cfg(feature = "defmt")]
 macro_rules! net_log {
     (trace, $($arg:expr),*) => { defmt::trace!($($arg),*) };