diff --git a/CHANGELOG.md b/CHANGELOG.md index d8e50f6b0..8cdc10419 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,10 @@ - Added a `pin-latest` setting to `~/.proto/config.toml` that'll automatically pin tools when they're being installed with the "latest" version. - Updated `proto install` to auto-clean stale plugins after a successful installation. +#### ⚙️ Internal + +- Added `PROTO_WASM_LOG` environment variable to toggle the logging of messages from Extism and WASM plugins. Useful for debugging. + ## 0.18.5 #### ⚙️ Internal diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 14f8ad0a8..026469457 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -31,6 +31,8 @@ async fn main() -> MainResult { LevelFilter::INFO }, filter_modules: string_vec!["proto", "starbase", "warpgate"], + // This swallows logs from extism when enabled + intercept_log: env::var("PROTO_WASM_LOG").is_err(), log_env: "STARBASE_LOG".into(), test_env: "PROTO_TEST".into(), ..TracingOptions::default() diff --git a/crates/core/src/helpers.rs b/crates/core/src/helpers.rs index 43c95a948..c9a7ab6cd 100644 --- a/crates/core/src/helpers.rs +++ b/crates/core/src/helpers.rs @@ -16,11 +16,6 @@ use tracing::trace; pub static ENV_VAR: Lazy = Lazy::new(|| Regex::new(r"\$([A-Z0-9_]+)").unwrap()); -#[deprecated = "Use `get_proto_home` instead."] -pub fn get_root() -> miette::Result { - get_proto_home() -} - pub fn get_proto_home() -> miette::Result { if let Ok(root) = env::var("PROTO_HOME") { return Ok(root.into()); diff --git a/crates/core/src/tool.rs b/crates/core/src/tool.rs index 00b5c3d8e..0c4b6d348 100644 --- a/crates/core/src/tool.rs +++ b/crates/core/src/tool.rs @@ -108,9 +108,11 @@ impl Tool { on_uninstalled_global: Emitter::new(), }; - #[cfg(debug_assertions)] - { - extism::set_log_file(proto.cwd.join("wasm-debug.log"), None); + if let Ok(level) = env::var("PROTO_WASM_LOG") { + extism::set_log_file( + proto.cwd.join("wasm-debug.log"), + std::str::FromStr::from_str(&level).ok(), + ); } debug!(