From fe5d6d59e6989dfc4e76586a1f8b142a1305a901 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 1 Sep 2020 14:34:12 -0700 Subject: [PATCH] wasi example: theres lots of useful tracing messages for debugging --- Cargo.lock | 2 ++ Cargo.toml | 2 ++ examples/wasi/main.rs | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index b2acc2ea90..c79c06601b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2419,6 +2419,8 @@ dependencies = [ "target-lexicon", "tempfile", "test-programs", + "tracing", + "tracing-subscriber", "wasi-common", "wasmtime", "wasmtime-cache", diff --git a/Cargo.toml b/Cargo.toml index ba36d92e89..666f918b14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,6 +51,8 @@ tempfile = "3.1.0" test-programs = { path = "crates/test-programs" } wasmtime-fuzzing = { path = "crates/fuzzing" } wasmtime-runtime = { path = "crates/runtime" } +tracing = "0.1.12" +tracing-subscriber = "0.2.0" [build-dependencies] anyhow = "1.0.19" diff --git a/examples/wasi/main.rs b/examples/wasi/main.rs index 35cb948135..5769069443 100644 --- a/examples/wasi/main.rs +++ b/examples/wasi/main.rs @@ -8,6 +8,11 @@ use wasmtime::*; use wasmtime_wasi::{Wasi, WasiCtx}; fn main() -> Result<()> { + tracing_subscriber::FmtSubscriber::builder() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .with_ansi(true) + .init(); + let store = Store::default(); let mut linker = Linker::new(&store);