summaryrefslogtreecommitdiff
path: root/cli/util
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-09-03 09:36:28 +0100
committerGitHub <noreply@github.com>2024-09-03 10:36:28 +0200
commit1f51b5310f85ad28f2d00ce223c59ff0be9619d0 (patch)
tree2b8c53fd35cd602b2307a658259416c7fecfe0aa /cli/util
parent45c1737531be882947e2f62038c0b72fbac921e3 (diff)
feat: support DENO_LOG env var instead of RUST_LOG (#25356)
Instead of `RUST_LOG` env var, we now support `DENO_LOG` env var. This is done to be able to set a setting specific to `deno` that wouldn't impact other binaries written in Rust. Ref https://github.com/denoland/deno/issues/10558#issuecomment-2324300211
Diffstat (limited to 'cli/util')
-rw-r--r--cli/util/logger.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/cli/util/logger.rs b/cli/util/logger.rs
index d64e9a707..cdc89411f 100644
--- a/cli/util/logger.rs
+++ b/cli/util/logger.rs
@@ -41,8 +41,10 @@ impl log::Log for CliLogger {
pub fn init(maybe_level: Option<log::Level>) {
let log_level = maybe_level.unwrap_or(log::Level::Info);
let logger = env_logger::Builder::from_env(
- env_logger::Env::default()
- .default_filter_or(log_level.to_level_filter().to_string()),
+ env_logger::Env::new()
+ // Use `DENO_LOG` and `DENO_LOG_STYLE` instead of `RUST_` prefix
+ .filter_or("DENO_LOG", log_level.to_level_filter().to_string())
+ .write_style("DENO_LOG_STYLE"),
)
// https://github.com/denoland/deno/issues/6641
.filter_module("rustyline", log::LevelFilter::Off)