Skip to main content

hopper_log

Macro hopper_log 

Source
macro_rules! hopper_log {
    ($label:expr, $a:expr) => { ... };
    ($label:expr, $a:expr, $b:expr) => { ... };
    ($label:expr, $a:expr, $b:expr, $c:expr) => { ... };
    ($label:expr, $a:expr, $b:expr, $c:expr, $d:expr) => { ... };
    ($label:expr, $a:expr, $b:expr, $c:expr, $d:expr, $e:expr) => { ... };
    ($msg:expr) => { ... };
}
Expand description

Cheap structured logging for hot handlers.

hopper_log! is the compute-unit-aware sibling of msg!. It dispatches to the backend’s native log syscall with no format machinery, no stack buffer, and no UTF-8 formatting pass. The tradeoff: fewer ergonomics, predictable CU.

Forms:

  • hopper_log!("static message") - one sol_log_ syscall.
  • hopper_log!(my_str_slice) - same, but for runtime &str values.
  • hopper_log!("label:", u64_value) - one sol_log_ plus one sol_log_64_. Five u64 slots (the sol_log_64_ ABI) are populated left-to-right and the rest zero.
  • hopper_log!("label:", a, b) through hopper_log!("label:", a, b, c, d, e) - same pattern; up to five integer values per call.

Reach for msg! when you need {}-style formatting. Reach for hopper_log! when you are paying for every CU and you already know the shape of the data.