lang: Add debug-log feature flag
@@ -21,6 +21,8 @@ pub fn generate(accs: AccountsStruct) -> proc_macro2::TokenStream {
let name = &s.ident;
let ty = &s.raw_field.ty;
quote! {
+ #[cfg(feature = "debug-log")]
+ ::solana_program::log::sol_log(stringify!(#name));
let #name: #ty = anchor_lang::Accounts::try_accounts(program_id, accounts)?;
}
}
@@ -38,9 +40,13 @@ pub fn generate(accs: AccountsStruct) -> proc_macro2::TokenStream {
let name = &f.typed_ident();
match f.is_init {
false => quote! {
+ #[cfg(feature = "debug-log")]
+ ::solana_program::log::sol_log(stringify!(#name));
let #name = anchor_lang::Accounts::try_accounts(program_id, accounts)?;
},
true => quote! {
+ #[cfg(feature = "debug-log")]
+ ::solana_program::log::sol_log(stringify!(#name));
let #name = anchor_lang::AccountsInit::try_accounts_init(program_id, accounts)?;
},
}
