Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 10 additions & 2 deletions crates/cli-flags/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Comment thread
SingleAccretion marked this conversation as resolved.
AttributeValue::DebugInfoRef(offset) => write!(f, "0x{:08x}", offset.0),
unexpected_attr => write!(f, "<unexpected attr: {unexpected_attr:?}>"),
}?;
Expand Down
3 changes: 3 additions & 0 deletions docs/cli-logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -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