debug_msg

Macro debug_msg 

Source
macro_rules! debug_msg {
    ($host: expr, $($args: expr),*) => { ... };
}
Expand description

Write a formatted message to host debug log. Formats follow core::fmt.

You can use debug_msg! with any variable such that implements Runtime. This is supported by any type implementing SmartRollupCore - such as RollupHost.

Using debug_msg! requires an allocator - so either you will need to include extern crate alloc when writing a kernel in a no_std context, or by depending on std. If you want to write debug logs without pulling in the allocator, use debug_str instead.

extern crate alloc;
use tezos_smart_rollup_debug::debug_msg;
use tezos_smart_rollup_host::runtime::Runtime;

fn log_runtime(host: &impl Runtime) {
  debug_msg!(host, "Simple constant string");

  debug_msg!(host, "A format {} with argument {}", "test", 5);
}