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 thesafecoin_client
crate logs at the “debug” level any logs for transactions that failed during simulation. If usingenv_logger
these logs can be activated by settingRUST_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, Pubkey
s can
also be efficiently logged with the Pubkey::log
function.
Macros
- infoDeprecatedPrint a message to the log.
- Print a message to the log.
Functions
- Print a string to the log.
- Print 64-bit values represented as hexadecimal to the log.
- Print the remaining compute units available to the program.
- Print some slices as base64.
- Print the hexadecimal representation of the program’s input parameters.
- Print the hexadecimal representation of a slice.