Module solana_sdk::log

source ·
Expand description

Logging utilities for Rust-based Safecoin programs.

Logging is the main mechanism for getting debugging information out of running Safecoin programs, and there are several functions available for doing so efficiently, depending on the type of data being logged.

The most common way to emit logs is through the msg! macro, which logs simple strings, as well as formatted strings.

Logs can be viewed in multiple ways:

  • The safecoin logs command displays logs for all transactions executed on a network. Note though that transactions that fail during pre-flight simulation are not displayed here.
  • When submitting transactions via RpcClient, if Rust’s own logging is active then the safecoin_client crate logs at the “debug” level any logs for transactions that failed during simulation. If using env_logger these logs can be activated by setting RUST_LOG=safecoin_client=debug.
  • Logs can be retrieved from a finalized transaction by calling RpcClient::get_transaction.
  • Block explorers may display logs.

While most logging functions are defined in this module, Pubkeys can also be efficiently logged with the Pubkey::log function.

Macros

  • infoDeprecated
    Print a message to the log.
  • Print a message to the log.

Functions