diff --git a/crates/cli-flags/src/lib.rs b/crates/cli-flags/src/lib.rs index 13203547421f..bfd5544e2353 100644 --- a/crates/cli-flags/src/lib.rs +++ b/crates/cli-flags/src/lib.rs @@ -541,11 +541,19 @@ impl CommonOptions { } else { use std::io::IsTerminal; use tracing_subscriber::{EnvFilter, FmtSubscriber}; - let b = FmtSubscriber::builder() + let builder = FmtSubscriber::builder() .with_writer(std::io::stderr) .with_env_filter(EnvFilter::from_env("WASMTIME_LOG")) .with_ansi(std::io::stderr().is_terminal()); - b.init(); + if std::env::var("WASMTIME_LOG_NO_CONTEXT").is_ok_and(|value| value.eq("1")) { + builder + .with_level(false) + .with_target(false) + .without_time() + .init() + } else { + builder.init(); + } } #[cfg(not(feature = "logging"))] if self.debug.log_to_files == Some(true) || self.debug.logging == Some(true) { diff --git a/crates/cranelift/src/debug/transform/debug_transform_logging.rs b/crates/cranelift/src/debug/transform/debug_transform_logging.rs index 7caee32ce798..f9dba2fac0f3 100644 --- a/crates/cranelift/src/debug/transform/debug_transform_logging.rs +++ b/crates/cranelift/src/debug/transform/debug_transform_logging.rs @@ -123,7 +123,10 @@ impl<'a> fmt::Debug for DieDetailedSummary<'a> { AttributeValue::CallingConvention(value) => write!(f, "{value}"), AttributeValue::Inline(value) => write!(f, "{value}"), AttributeValue::Ordering(value) => write!(f, "{value}"), - AttributeValue::UnitRef(offset) => write!(f, "0x{:08x}", offset.0), + AttributeValue::UnitRef(offset) => { + let section_offset = offset.to_unit_section_offset(unit); + write!(f, "0x{:08x}", get_offset_value(section_offset)) + } AttributeValue::DebugInfoRef(offset) => write!(f, "0x{:08x}", offset.0), unexpected_attr => write!(f, ""), }?; diff --git a/docs/cli-logging.md b/docs/cli-logging.md index 7d0b1ba0c575..8f47fa634a48 100644 --- a/docs/cli-logging.md +++ b/docs/cli-logging.md @@ -23,6 +23,9 @@ Wasmtime can also redirect the log messages into log files, with the `-D log-to-files` option. It creates one file per thread within Wasmtime, with the files named `wasmtime.dbg.*`. +Additional environment variables that work with `WASMTIME_LOG` (__not__ `-D log-to-files`): + - `WASMTIME_LOG_NO_CONTEXT`: if set to `1`, removes the time, level and target from output. + [`log`]: https://crates.io/crates/log [`tracing-subscriber`]: https://crates.io/crates/tracing-subscriber [tracing-subscriber's EnvFilter docs]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives