#solana #on-chain #better #logging #msg #debugging #error

solana-msg-utils

macros for efficient on-chain logging and better error handling / debugging

2 releases

0.1.1 Mar 17, 2022
0.1.0 Mar 17, 2022

#38 in #msg

MIT/Apache

7KB
56 lines

solana-msg-utils

utilities for emitting efficient messages on-chain.

Usage

Add the following to your Cargo.toml file:

[dependencies]
solana-msg-utils = "0.1.0"

then you can use the crate like so:

// emit a trace level msg
use solana_program::msg;
use solana_msg_utils::{msg_trace, msg_panic, sum};
msg_trace!("{}", "this is a trace level log");
msg_panic!("{}", "this is a traced & off-chain parsable panic message for better error handling than annoying decimal numbers and hexadecimal digits, because debugging that is really, really f**king tilting (if you cant tell)");

Documentation


lib.rs:

Provides macros used for logging messages on-chain, with the ability to provide "trace level" logging messages.

In addition to this, the trace level logging messages utilizes stack based formatting if the message size is less than 512 bytes for maximal compute units consumption efficiency

Dependencies

~11–20MB
~284K SLoC