GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • 1. Introduction
  • 2. Using the Wasmtime CLI
  • 2.1. Installation
  • 2.2. CLI Options
  • 2.3. CLI Logging
  • 2.4. Cache Configuration
  • 3. Using the Wasmtime API
  • 3.1. Hello, world!
  • 3.2. Calculating the GCD
  • 3.3. Using Linear Memory
  • 3.4. Linking Modules
  • 3.5. anyref Reference Type
  • 3.6. externref Reference Type
  • 3.7. Multiple Memories

This view

  • Original page
  • New address

GeezerVison is showing docs.wasmtime.dev — CLI Logging - Wasmtime

Logging in the wasmtime CLI

Wasmtime's libraries use Rust's log crate to log diagnostic 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. For more information on specifying filters, see tracing-subscriber's EnvFilter docs.

$ 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!
TRACE wiggle abi{module="wasi_snapshot_preview1" function="fd_write"}: wasmtime_wasi::preview1::wasi_snapshot_preview1: result=Ok(14)
TRACE wiggle abi{module="wasi_snapshot_preview1" function="proc_exit"}: wasmtime_wasi::preview1::wasi_snapshot_preview1: rval=1
TRACE wiggle abi{module="wasi_snapshot_preview1" function="proc_exit"}: wasmtime_wasi::preview1::wasi_snapshot_preview1: result=Exited with i32 exit status 1

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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.