1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
use {
crate::{ic_logger_msg, log_collector::LogCollector},
itertools::Itertools,
solana_sdk::{instruction::InstructionError, pubkey::Pubkey},
std::{cell::RefCell, rc::Rc},
};
pub fn program_invoke(
log_collector: &Option<Rc<RefCell<LogCollector>>>,
program_id: &Pubkey,
invoke_depth: usize,
) {
ic_logger_msg!(
log_collector,
"Program {} invoke [{}]",
program_id,
invoke_depth
);
}
pub fn program_log(log_collector: &Option<Rc<RefCell<LogCollector>>>, message: &str) {
ic_logger_msg!(log_collector, "Program log: {}", message);
}
pub fn program_data(log_collector: &Option<Rc<RefCell<LogCollector>>>, data: &[&[u8]]) {
ic_logger_msg!(
log_collector,
"Program data: {}",
data.iter().map(base64::encode).join(" ")
);
}
pub fn program_return(
log_collector: &Option<Rc<RefCell<LogCollector>>>,
program_id: &Pubkey,
data: &[u8],
) {
ic_logger_msg!(
log_collector,
"Program return: {} {}",
program_id,
base64::encode(data)
);
}
pub fn program_success(log_collector: &Option<Rc<RefCell<LogCollector>>>, program_id: &Pubkey) {
ic_logger_msg!(log_collector, "Program {} success", program_id);
}
pub fn program_failure(
log_collector: &Option<Rc<RefCell<LogCollector>>>,
program_id: &Pubkey,
err: &InstructionError,
) {
ic_logger_msg!(log_collector, "Program {} failed: {}", program_id, err);
}