diff --git a/CHANGELOG.md b/CHANGELOG.md index 841a009f417..fd93984f40b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## **[Unreleased]** -- [#1147](https://github.com/wasmerio/wasmer/pull/1147) Remove `log` and `trace` macros from `wasmer-runtime-core`, remove `debug` and `trace` features from `wasmer-*` crates, use the `log` crate for logging and use `fern` in the Wasmer CLI binary to output log messages. To disable colorized output, set the `WASMER_DISABLE_COLOR` environment variable. +- [#1147](https://github.com/wasmerio/wasmer/pull/1147) Remove `log` and `trace` macros from `wasmer-runtime-core`, remove `debug` and `trace` features from `wasmer-*` crates, use the `log` crate for logging and use `fern` in the Wasmer CLI binary to output log messages. Colorized output will be enabled automatically if printing to a terminal, to force colorization on or off, set the `WASMER_COLOR` environment variable to `true` or `false`. - [#1128](https://github.com/wasmerio/wasmer/pull/1128) Fix a crash when a host function is missing and the `allow_missing_functions` flag is enabled - [#1099](https://github.com/wasmerio/wasmer/pull/1099) Remove `backend::Backend` from `wasmer_runtime_core` - [#1097](https://github.com/wasmerio/wasmer/pull/1097) Move inline breakpoint outside of runtime backend diff --git a/Cargo.lock b/Cargo.lock index a8df02ffb20..afca5c359bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1675,6 +1675,7 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" name = "wasmer" version = "0.12.0" dependencies = [ + "atty", "byteorder", "errno", "fern", diff --git a/Cargo.toml b/Cargo.toml index 0f4ba3f6ccc..945e2de10de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ include = [ ] [dependencies] +atty = "0.2" byteorder = "1.3" errno = "0.2" fern = { version = "0.5", features = ["colored"], optional = true } diff --git a/Makefile b/Makefile index 01bcf1481bc..18e5c31e3d1 100644 --- a/Makefile +++ b/Makefile @@ -231,30 +231,30 @@ check: check-bench cargo check --release --manifest-path lib/runtime/Cargo.toml $(RUNTIME_CHECK) \ - --features=cranelift,cache,debug,llvm,singlepass,default-backend-singlepass + --features=cranelift,cache,llvm,singlepass,default-backend-singlepass $(RUNTIME_CHECK) --release \ --features=cranelift,cache,llvm,singlepass,default-backend-singlepass $(RUNTIME_CHECK) \ - --features=cranelift,cache,debug,llvm,singlepass,default-backend-cranelift + --features=cranelift,cache,llvm,singlepass,default-backend-cranelift $(RUNTIME_CHECK) --release \ --features=cranelift,cache,llvm,singlepass,default-backend-cranelift $(RUNTIME_CHECK) \ - --features=cranelift,cache,debug,llvm,singlepass,default-backend-llvm + --features=cranelift,cache,llvm,singlepass,default-backend-llvm $(RUNTIME_CHECK) --release \ --features=cranelift,cache,llvm,singlepass,default-backend-llvm $(RUNTIME_CHECK) \ - --features=singlepass,default-backend-singlepass,debug + --features=singlepass,default-backend-singlepass $(RUNTIME_CHECK) --release \ --features=singlepass,default-backend-singlepass $(RUNTIME_CHECK) \ - --features=cranelift,default-backend-cranelift,debug + --features=cranelift,default-backend-cranelift $(RUNTIME_CHECK) --release \ --features=cranelift,default-backend-cranelift $(RUNTIME_CHECK) \ - --features=llvm,default-backend-llvm,debug + --features=llvm,default-backend-llvm $(RUNTIME_CHECK) --release \ --features=llvm,default-backend-llvm - --features=default-backend-singlepass,singlepass,cranelift,llvm,cache,debug,deterministic-execution + --features=default-backend-singlepass,singlepass,cranelift,llvm,cache,deterministic-execution # Release release: diff --git a/src/utils.rs b/src/utils.rs index da498956b7f..20abb91d51a 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -122,7 +122,8 @@ pub fn parse_args( /// Whether or not Wasmer should print with color pub fn wasmer_should_print_color() -> bool { - std::env::var("WASMER_DISABLE_COLOR") - .map(|_| false) - .unwrap_or(true) + std::env::var("WASMER_COLOR") + .ok() + .and_then(|inner| inner.parse::().ok()) + .unwrap_or(atty::is(atty::Stream::Stdout)) }