Skip to content

Commit

Permalink
Add env var.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Sep 27, 2023
1 parent c0b991f commit 7dee354
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 2 additions & 0 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 0 additions & 5 deletions crates/core/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ use tracing::trace;

pub static ENV_VAR: Lazy<Regex> = Lazy::new(|| Regex::new(r"\$([A-Z0-9_]+)").unwrap());

#[deprecated = "Use `get_proto_home` instead."]
pub fn get_root() -> miette::Result<PathBuf> {
get_proto_home()
}

pub fn get_proto_home() -> miette::Result<PathBuf> {
if let Ok(root) = env::var("PROTO_HOME") {
return Ok(root.into());
Expand Down
8 changes: 5 additions & 3 deletions crates/core/src/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down

0 comments on commit 7dee354

Please sign in to comment.