Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor logging tweaks #7242

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ wasmtime-runtime = { workspace = true }
clap = { workspace = true, features = ["color", "suggestions", "derive"] }
anyhow = { workspace = true }
target-lexicon = { workspace = true }
tracing-subscriber = { workspace = true }
once_cell = { workspace = true }
listenfd = "1.0.0"
wat = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/cli-flags/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ edition.workspace = true
anyhow = { workspace = true }
clap = { workspace = true }
file-per-thread-logger = { workspace = true }
pretty_env_logger = { workspace = true }
tracing-subscriber = { workspace = true }
rayon = "1.5.0"
wasmtime = { workspace = true }
humantime = "2.0.0"
Expand Down
10 changes: 9 additions & 1 deletion crates/cli-flags/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

use anyhow::Result;
use clap::Parser;
use std::io::IsTerminal;
use std::time::Duration;
use tracing_subscriber::{EnvFilter, FmtSubscriber};
use wasmtime::Config;

pub mod opt;
Expand Down Expand Up @@ -328,7 +330,13 @@ impl CommonOptions {
let prefix = "wasmtime.dbg.";
init_file_per_thread_logger(prefix);
} else {
pretty_env_logger::init();
let mut b = FmtSubscriber::builder()
.with_writer(std::io::stderr)
.with_env_filter(EnvFilter::from_env("WASMTIME_LOG"));
if std::io::stderr().is_terminal() {
b = b.with_ansi(true);
}
b.init();
}
}

Expand Down
10 changes: 0 additions & 10 deletions src/bin/wasmtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ impl Wasmtime {
}

fn main() -> Result<()> {
use std::io::IsTerminal;
use tracing_subscriber::{EnvFilter, FmtSubscriber};

let mut b = FmtSubscriber::builder()
.with_writer(std::io::stderr)
.with_env_filter(EnvFilter::from_env("WASMTIME_LOG"));
if std::io::stderr().is_terminal() {
b = b.with_ansi(true);
}
b.init();
Wasmtime::parse().execute()
}

Expand Down
6 changes: 1 addition & 5 deletions tests/all/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn get_wasmtime_command() -> Result<Command> {
// If we're running tests with a "runner" then we might be doing something
// like cross-emulation, so spin up the emulator rather than the tests
// itself, which may not be natively executable.
let mut cmd = if let Some((_, runner)) = runner {
let cmd = if let Some((_, runner)) = runner {
let mut parts = runner.split_whitespace();
let mut cmd = Command::new(parts.next().unwrap());
for arg in parts {
Expand All @@ -44,10 +44,6 @@ pub fn get_wasmtime_command() -> Result<Command> {
Command::new(&me)
};

if let Ok(val) = std::env::var("WASMTIME_LOG") {
cmd.env("WASMTIME_LOG", val);
}

Ok(cmd)
}

Expand Down