Skip to content

Commit

Permalink
corrections to the WASMTIME_LOG docs (#8669)
Browse files Browse the repository at this point in the history
* its tracing-subscriber now, not pretty_env_logger
* point to tracing-subscribers docs on filter directives
* correct invocation of wasmtime in the example
  • Loading branch information
pchickey authored May 21, 2024
1 parent cc93e8f commit 3c8bb26
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/cli-logging.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Logging in the `wasmtime` CLI

Wasmtime's libraries use Rust's [`log`] crate to log diagnostic
information, and the `wasmtime` CLI executable uses [`pretty_env_logger`]
by default for logging this information to the console.
information, and the `wasmtime` CLI executable uses [`tracing-subscriber`]
for displaying this information on the console.

Basic logging is controlled by the `WASMTIME_LOG` environment variable. For example,
To enable logging of WASI system calls, similar to the `strace` command on Linux,
set `WASMTIME_LOG=wasmtime_wasi=trace`.
set `WASMTIME_LOG=wasmtime_wasi=trace`. For more information on specifying
filters, see [tracing-subscriber's EnvFilter docs].

```sh
$ WASMTIME_LOG=wasmtime_wasi=trace hello.wasm
$ WASMTIME_LOG=wasmtime_wasi=trace wasmtime hello.wasm
[...]
TRACE wiggle abi{module="wasi_snapshot_preview1" function="fd_write"} wasmtime_wasi::preview1::wasi_snapshot_preview1 > fd=Fd(1) iovs=*guest 0x14/1
Hello, world!
Expand All @@ -23,4 +24,5 @@ Wasmtime can also redirect the log messages into log files, with the
the files named `wasmtime.dbg.*`.

[`log`]: https://crates.io/crates/log
[`pretty_env_logger`]: https://crates.io/crates/pretty_env_logger
[`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

0 comments on commit 3c8bb26

Please sign in to comment.