Add msg! macro for program logging, deprecate info! macro

This commit is contained in:
Michael Vines
2020-11-30 13:28:58 -08:00
parent 254790f8c8
commit 6705b5a98c
22 changed files with 162 additions and 141 deletions

View File

@ -5,7 +5,7 @@
extern crate solana_program;
use solana_program::{
account_info::AccountInfo, bpf_loader, entrypoint_deprecated,
entrypoint_deprecated::ProgramResult, info, log::*, pubkey::Pubkey,
entrypoint_deprecated::ProgramResult, log::*, msg, pubkey::Pubkey,
};
#[derive(Debug, PartialEq)]
@ -26,7 +26,7 @@ fn process_instruction(
accounts: &[AccountInfo],
instruction_data: &[u8],
) -> ProgramResult {
info!("Program identifier:");
msg!("Program identifier:");
program_id.log();
assert!(!bpf_loader::check_id(program_id));
@ -34,7 +34,7 @@ fn process_instruction(
// Log the provided account keys and instruction input data. In the case of
// the no-op program, no account keys or input data are expected but real
// programs will have specific requirements so they can do their work.
info!("Account keys and instruction input data:");
msg!("Account keys and instruction input data:");
sol_log_params(accounts, instruction_data);
{
@ -45,7 +45,7 @@ fn process_instruction(
let result_str = std::str::from_utf8(&sparkle_heart).unwrap();
assert_eq!(4, result_str.len());
assert_eq!("💖", result_str);
info!(result_str);
msg!(result_str);
}
{