1
1
use std:: collections:: HashSet ;
2
2
use std:: fs:: File ;
3
3
use std:: io:: Read ;
4
- use std:: path:: Path ;
5
4
use std:: process:: exit;
6
5
7
6
use clap:: { Arg , ArgAction , Command } ;
8
7
use colored:: Colorize ;
9
8
10
9
use cosmwasm_vm:: capabilities_from_csv;
11
- use cosmwasm_vm:: internals:: { check_wasm_with_logs, compile, make_compiling_engine, Logger } ;
10
+ use cosmwasm_vm:: internals:: {
11
+ check_wasm_with_logs, compile, make_compiling_engine, LogOutput , Logger ,
12
+ } ;
12
13
13
14
const DEFAULT_AVAILABLE_CAPABILITIES : & str =
14
15
"iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1" ;
@@ -93,7 +94,7 @@ pub fn main() {
93
94
}
94
95
95
96
fn check_contract (
96
- path : impl AsRef < Path > ,
97
+ path : & str ,
97
98
available_capabilities : & HashSet < String > ,
98
99
verbose : bool ,
99
100
) -> anyhow:: Result < ( ) > {
@@ -103,7 +104,15 @@ fn check_contract(
103
104
let mut wasm = Vec :: < u8 > :: new ( ) ;
104
105
file. read_to_end ( & mut wasm) ?;
105
106
106
- let logs = if verbose { Logger :: new ( ) } else { Logger :: Off } ;
107
+ let prefix = format ! ( "{}: " , path) ;
108
+ let logs = if verbose {
109
+ Logger :: On {
110
+ prefix : & prefix,
111
+ output : LogOutput :: StdErr ,
112
+ }
113
+ } else {
114
+ Logger :: Off
115
+ } ;
107
116
// Check wasm
108
117
check_wasm_with_logs ( & wasm, available_capabilities, logs) ?;
109
118
0 commit comments