Skip to content

Commit eff66a5

Browse files
committed
Add prefix to cosmwasm-check verbose logger
1 parent 0cf1f66 commit eff66a5

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

packages/check/src/main.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
use std::collections::HashSet;
22
use std::fs::File;
33
use std::io::Read;
4-
use std::path::Path;
54
use std::process::exit;
65

76
use clap::{Arg, ArgAction, Command};
87
use colored::Colorize;
98

109
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+
};
1213

1314
const DEFAULT_AVAILABLE_CAPABILITIES: &str =
1415
"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() {
9394
}
9495

9596
fn check_contract(
96-
path: impl AsRef<Path>,
97+
path: &str,
9798
available_capabilities: &HashSet<String>,
9899
verbose: bool,
99100
) -> anyhow::Result<()> {
@@ -103,7 +104,15 @@ fn check_contract(
103104
let mut wasm = Vec::<u8>::new();
104105
file.read_to_end(&mut wasm)?;
105106

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+
};
107116
// Check wasm
108117
check_wasm_with_logs(&wasm, available_capabilities, logs)?;
109118

packages/vm/src/compatibility.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,6 @@ pub enum Logger<'a> {
113113
}
114114

115115
impl<'a> Logger<'a> {
116-
pub fn new() -> Self {
117-
On {
118-
output: LogOutput::StdOut,
119-
prefix: "",
120-
}
121-
}
122-
123116
pub fn with_config(output: LogOutput, prefix: &'a str) -> Self {
124117
On { output, prefix }
125118
}

0 commit comments

Comments
 (0)