Skip to content

Commit c93edff

Browse files
committed
fixup: reduce logs, use CODSPEED_LOG, ignore handlebars logs
1 parent e820139 commit c93edff

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

go-runner/src/builder/patcher.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ pub fn patch_imports<P: AsRef<Path>>(
1010
files_to_patch: Vec<PathBuf>,
1111
) -> anyhow::Result<()> {
1212
let folder = folder.as_ref();
13-
info!("Patching imports in folder: {folder:?}");
14-
15-
info!("Found {} Go files to patch", files_to_patch.len());
13+
debug!("Patching imports in folder: {folder:?}");
1614

1715
// 2. Find all imports that match "testing" and replace them with codspeed equivalent
1816
let mut patched_files = 0;
@@ -30,28 +28,21 @@ pub fn patch_imports<P: AsRef<Path>>(
3028
patched_files += 1;
3129
}
3230
}
33-
34-
info!("Patched {patched_files} files");
31+
debug!("Patched {patched_files} files");
3532

3633
// 3. Update the go module to use the codspeed package
37-
info!("Updating Go module to include codspeed-go dependency");
38-
39-
let mut cmd = Command::new("go");
34+
let mut cmd: Command = Command::new("go");
4035
cmd.arg("get")
4136
.arg("github.com/AvalancheHQ/codspeed-go@cod-1172-create-codspeed-go-repository-with-the-compat-layer")
4237
.current_dir(folder);
4338

4439
let output = cmd.output().context("Failed to execute 'go get' command")?;
45-
4640
if !output.status.success() {
4741
let stderr = String::from_utf8_lossy(&output.stderr);
48-
bail!(
49-
"Failed to update Go module with codspeed dependency: {}",
50-
stderr
51-
);
42+
bail!("Failed to install codspeed-go dependency: {}", stderr);
5243
}
5344

54-
info!("Successfully updated Go module with codspeed-go dependency");
45+
info!("Successfully installed codspeed-go dependency");
5546

5647
Ok(())
5748
}

go-runner/src/builder/runner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn build<P: AsRef<Path>>(runner_go_path: P) -> anyhow::Result<PathBuf> {
1010
let file_dir = runner_go_path.parent().unwrap();
1111
let module_root = file_dir.parent().unwrap();
1212
let relative_path = runner_go_path.strip_prefix(module_root).unwrap();
13-
info!(
13+
debug!(
1414
"Building codspeed runner: {:?} (root = {:?})",
1515
module_root.join(relative_path),
1616
module_root

go-runner/src/builder/templater.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn run(package: &GoPackage) -> anyhow::Result<(TempDir, PathBuf)> {
3333
"Package dir {:?} is not within module dir {:?}",
3434
package.dir, package.module.dir
3535
))?;
36-
info!("Relative package path: {relative_package_path:?}");
36+
debug!("Relative package path: {relative_package_path:?}");
3737

3838
// 2. Find benchmark files and patch their imports
3939
let benchmarks = package.benchmarks()?;

go-runner/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ use go_runner::cli::Cli;
22
use std::path::Path;
33

44
fn main() -> anyhow::Result<()> {
5-
env_logger::init();
5+
env_logger::builder()
6+
.parse_env("CODSPEED_LOG")
7+
.filter_module("handlebars", log::LevelFilter::Off)
8+
.init();
69

710
let cli = Cli::parse();
811
go_runner::run_benchmarks(Path::new("."), &cli.bench)?;

0 commit comments

Comments
 (0)