macro_rules! debug { ($fmt:expr) => { ... }; ($fmt:expr, $($args:tt)*) => { ... }; }
Expand description
Add a debug message to the log.
Debug messages are available only if the program is compiled in debug mode.
cargo build --debug
cargo build --features=debug
You can see the debug messages when running the program using the gtest
crate. To see these messages when executing the program on the node, you
should run the node with the RUST_LOG="gwasm=debug"
environment variable.
Note: message size is limited to
MAX_BUFFER_SIZE
.
Message is truncated if it exceeds maximum buffer size.
If you need bigger message size, consider using gstd::heap_debug!()
macro.
§Examples
use gcore::debug;
#[no_mangle]
extern "C" fn handle() {
debug!("String literal");
let value = 42;
debug!("{value}");
debug!("Formatted: value = {value}");
}