diff --git a/libbpf-cargo/CHANGELOG.md b/libbpf-cargo/CHANGELOG.md index 0a5dfc4a..300c0e71 100644 --- a/libbpf-cargo/CHANGELOG.md +++ b/libbpf-cargo/CHANGELOG.md @@ -5,6 +5,7 @@ Unreleased sub-command - Replaced `--debug` option of `libbpf` sub-command with `-v` / `--verbose` + - Removed `--quiet` option of `libbpf make` sub-command 0.25.0-beta.1 diff --git a/libbpf-cargo/src/main.rs b/libbpf-cargo/src/main.rs index e18c6627..402d84a6 100644 --- a/libbpf-cargo/src/main.rs +++ b/libbpf-cargo/src/main.rs @@ -90,9 +90,6 @@ enum Command { manifest_path: Option, #[command(flatten)] clang_opts: ClangOpts, - #[arg(short, long)] - /// Quiet output - quiet: bool, /// Arguments to pass to `cargo build` /// /// Example: cargo libbpf build -- --package mypackage @@ -146,14 +143,12 @@ fn main() -> Result<()> { clang_path, clang_args, }, - quiet, cargo_build_args, rustfmt_path, } => make::make( manifest_path.as_ref(), clang_path.as_ref(), clang_args, - quiet, cargo_build_args, rustfmt_path.as_ref(), ), diff --git a/libbpf-cargo/src/make.rs b/libbpf-cargo/src/make.rs index f97d8c65..f0d89068 100644 --- a/libbpf-cargo/src/make.rs +++ b/libbpf-cargo/src/make.rs @@ -5,32 +5,29 @@ use std::process::Command; use anyhow::bail; use anyhow::Context; use anyhow::Result; +use log::debug; +use log::log_enabled; +use log::Level::Info; use crate::build; use crate::gen; -#[allow(clippy::too_many_arguments)] pub fn make( manifest_path: Option<&PathBuf>, clang: Option<&PathBuf>, clang_args: Vec, - quiet: bool, cargo_build_args: Vec, rustfmt_path: Option<&PathBuf>, ) -> Result<()> { - if !quiet { - println!("Compiling BPF objects"); - } + debug!("Compiling BPF objects"); build::build(manifest_path, clang, clang_args).context("Failed to compile BPF objects")?; - if !quiet { - println!("Generating skeletons"); - } + debug!("Generating skeletons"); gen::gen(manifest_path, None, rustfmt_path).context("Failed to generate skeletons")?; let mut cmd = Command::new("cargo"); cmd.arg("build"); - if quiet { + if !log_enabled!(Info) { cmd.arg("--quiet"); } for arg in cargo_build_args { diff --git a/libbpf-cargo/src/test.rs b/libbpf-cargo/src/test.rs index 7d3eb8b9..0fd1de67 100644 --- a/libbpf-cargo/src/test.rs +++ b/libbpf-cargo/src/test.rs @@ -301,7 +301,7 @@ fn test_make_basic() { let _prog_file = File::create(proj_dir.join("src/bpf/prog.bpf.c")).expect("failed to create prog file"); - make(Some(&cargo_toml), None, Vec::new(), true, Vec::new(), None).unwrap(); + make(Some(&cargo_toml), None, Vec::new(), Vec::new(), None).unwrap(); // Validate generated object file validate_bpf_o(proj_dir.as_path().join("target/bpf/prog.bpf.o").as_path()); @@ -333,7 +333,6 @@ fn test_make_workspace() { Some(&workspace_cargo_toml), None, Vec::new(), - true, Vec::new(), None, ) @@ -385,7 +384,7 @@ fn build_rust_project_from_bpf_c_impl(bpf_c: &str, rust: &str, run: bool) { // Lay down the necessary header files add_vmlinux_header(&proj_dir); - make(Some(&cargo_toml), None, Vec::new(), true, Vec::new(), None).unwrap(); + make(Some(&cargo_toml), None, Vec::new(), Vec::new(), None).unwrap(); let mut cargo = OpenOptions::new() .append(true)