solana_sdk

Macro msg

source
macro_rules! msg {
    ($msg:expr) => { ... };
    ($($arg:tt)*) => { ... };
}
Expand description

Print a message to the log.

Supports simple strings as well as Rust format strings. When passed a single expression it will be passed directly to sol_log. The expression must have type &str, and is typically used for logging static strings. When passed something other than an expression, particularly a sequence of expressions, the tokens will be passed through the format! macro before being logged with sol_log.

Note that Rust’s formatting machinery is relatively CPU-intensive for constrained environments like the Solana VM.

§Examples

use solana_program::msg;

// The fast form
msg!("verifying multisig");

// With formatting
let err = "not enough signers";
msg!("multisig failed: {}", err);