diff --git a/near-sdk/src/utils/mod.rs b/near-sdk/src/utils/mod.rs index ce77c721a..6ae2fbf1a 100644 --- a/near-sdk/src/utils/mod.rs +++ b/near-sdk/src/utils/mod.rs @@ -10,7 +10,7 @@ pub(crate) use cache_entry::{CacheEntry, EntryState}; use crate::{env, NearToken, PromiseResult}; /// Helper macro to log a message through [`env::log_str`]. -/// This macro can be used similar to the [`std::format`] macro in most cases. +/// This macro can be used similar to the [`std::format`] macro. /// /// This differs from [`std::format`] because instead of generating a string, it will log the utf8 /// bytes as a log through [`env::log_str`]. @@ -25,7 +25,7 @@ use crate::{env, NearToken, PromiseResult}; /// # fn main() { /// log!("test"); /// let world: &str = "world"; -/// log!(world); +/// log!("{world}"); /// log!("Hello {}", world); /// log!("x = {}, y = {y}", 10, y = 30); /// # } @@ -34,11 +34,8 @@ use crate::{env, NearToken, PromiseResult}; /// [`env::log_str`]: crate::env::log_str #[macro_export] macro_rules! log { - ($arg:expr) => { - $crate::env::log_str($arg.as_ref()) - }; ($($arg:tt)*) => { - $crate::env::log_str(format!($($arg)*).as_str()) + $crate::env::log_str(::std::format!($($arg)*).as_str()) }; }