Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

replaced println with log Closes #12338 #12348

Merged
merged 7 commits into from
Oct 28, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion utils/frame/benchmarking-cli/src/pallet/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
use sp_state_machine::StateMachine;
use std::{collections::HashMap, fmt::Debug, fs, sync::Arc, time};

/// Logging target
const LOG_TARGET:&'static str = "frame::benchmark::pallet";

/// The inclusive range of a component.
#[derive(Serialize, Debug, Clone, Eq, PartialEq)]
pub(crate) struct ComponentRange {
Expand Down Expand Up @@ -242,7 +245,12 @@ impl PalletCmd {
let mut component_ranges = HashMap::<(Vec<u8>, Vec<u8>), Vec<ComponentRange>>::new();

for (pallet, extrinsic, components) in benchmarks_to_run {

log::info!(
target: LOG_TARGET,

println!(

"Starting benchmark: {}::{}",
shawntabrizi marked this conversation as resolved.
Show resolved Hide resolved
String::from_utf8(pallet.clone()).expect("Encoded from String; qed"),
String::from_utf8(extrinsic.clone()).expect("Encoded from String; qed"),
Expand Down Expand Up @@ -402,7 +410,12 @@ impl PalletCmd {
if let Ok(elapsed) = timer.elapsed() {
if elapsed >= time::Duration::from_secs(5) {
timer = time::SystemTime::now();

log::info!(
target: LOG_TARGET,

println!(
shawntabrizi marked this conversation as resolved.
Show resolved Hide resolved

shawntabrizi marked this conversation as resolved.
Show resolved Hide resolved
"Running Benchmark: {}.{}({} args) {}/{} {}/{}",
String::from_utf8(pallet.clone())
.expect("Encoded from String; qed"),
Expand Down Expand Up @@ -492,7 +505,7 @@ impl PalletCmd {
if let Some(path) = &self.json_file {
fs::write(path, json)?;
} else {
println!("{}", json);
print!("{json}");
return Ok(true)
}
}
Expand Down