docs: Use "msg!" instead of "info!" (#14411)

* docs: Use "msg!" instead of "info!"

* Update docs/src/developing/deployed-programs/developing-rust.md

Co-authored-by: Michael Vines <mvines@gmail.com>

* Fix typo / format

Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
Jon Cinque
2021-01-04 20:49:09 +01:00
committed by GitHub
parent f24d361e1a
commit a41b5137f6

View File

@ -276,24 +276,24 @@ getrandom = { version = "0.1.14", features = ["dummy"] }
Rust's `println!` macro is computationally expensive and not supported. Instead Rust's `println!` macro is computationally expensive and not supported. Instead
the helper macro the helper macro
[`info!`](https://github.com/solana-labs/solana/blob/7ddf10e602d2ed87a9e3737aa8c32f1db9f909d8/sdk/program/src/log.rs#L10) [`msg!`](https://github.com/solana-labs/solana/blob/6705b5a98c076ac08f3991bb8a6f9fcb280bf51e/sdk/program/src/log.rs#L33)
is provided. is provided.
`info!` has two forms: `msg!` has two forms:
```rust ```rust
info!("A string"); msg!("A string");
``` ```
or or
```rust ```rust
info!(0_64, 1_64, 2_64, 3_64, 4_64) msg!(0_64, 1_64, 2_64, 3_64, 4_64);
``` ```
Both forms output the results to the program logs. If a program so wishes they Both forms output the results to the program logs. If a program so wishes they
can emulate `println!` by using `format!`: can emulate `println!` by using `format!`:
```rust ```rust
info!(&format!("Some varialbe: {:?}", variable)); msg!("Some variable: {:?}", variable);
``` ```
The [debugging](debugging.md#logging) section has more information about working The [debugging](debugging.md#logging) section has more information about working
@ -333,8 +333,8 @@ Then provide a custom implementation of the panic handler:
#[cfg(all(feature = "custom-panic", target_arch = "bpf"))] #[cfg(all(feature = "custom-panic", target_arch = "bpf"))]
#[no_mangle] #[no_mangle]
fn custom_panic(info: &core::panic::PanicInfo<'_>) { fn custom_panic(info: &core::panic::PanicInfo<'_>) {
solana_program::info!("program custom panic enabled"); solana_program::msg!("program custom panic enabled");
solana_program::info!(&format!("{}", info)); solana_program::msg!("{}", info);
} }
``` ```