From cc25c483336fd4e9521effc4b8a90af5e406e3a1 Mon Sep 17 00:00:00 2001 From: Florian Lehner Date: Mon, 17 Feb 2025 13:21:25 +0100 Subject: [PATCH] rust: use macro for debug output Use macro debug instead of eprintln for debug messages. Follow up to https://github.com/open-telemetry/opentelemetry-ebpf-profiler/pull/267#discussion_r1909802362. Signed-off-by: Florian Lehner --- rust-crates/symblib/src/symbconv/dwarf/mod.rs | 2 +- rust-crates/symblib/src/symbconv/go.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-crates/symblib/src/symbconv/dwarf/mod.rs b/rust-crates/symblib/src/symbconv/dwarf/mod.rs index 260980f12..3e3af89e7 100644 --- a/rust-crates/symblib/src/symbconv/dwarf/mod.rs +++ b/rust-crates/symblib/src/symbconv/dwarf/mod.rs @@ -341,7 +341,7 @@ fn extract_ranges( } }; - eprintln!("Processing {:?}", &unit); + debug!("Processing {:?}", &unit); match process_unit(unit, &mut visitor) { Ok(()) => stats.units_ok += 1, Err(e) => { diff --git a/rust-crates/symblib/src/symbconv/go.rs b/rust-crates/symblib/src/symbconv/go.rs index 25c379e0f..a5ac90d3f 100644 --- a/rust-crates/symblib/src/symbconv/go.rs +++ b/rust-crates/symblib/src/symbconv/go.rs @@ -6,7 +6,7 @@ //! This is currently still very basic and doesn't support inline functions //! or constructing line tables. -use crate::{gosym, objfile, symbfile, AnyError}; +use crate::{debug, gosym, objfile, symbfile, AnyError}; use fallible_iterator::FallibleIterator as _; /// Result type shorthand. @@ -70,7 +70,7 @@ fn extract_ranges(obj: &objfile::Reader<'_>, visitor: super::RangeVisitor<'_>) - while let Some(func) = func_iter.next()? { // Infer end of function from line tables. let Some(end) = func.line_mapping()?.map(|(rng, _)| Ok(rng.end)).max()? else { - eprintln!( + debug!( "WARN: unable to determine end of function ({})", func.name()? ); @@ -80,7 +80,7 @@ fn extract_ranges(obj: &objfile::Reader<'_>, visitor: super::RangeVisitor<'_>) - let length = end.saturating_sub(func.start_addr()); if length == 0 { - eprintln!("WARN: zero function length ({})", func.name()?); + debug!("WARN: zero function length ({})", func.name()?); stats.funcs_skipped += 1; continue; }