Skip to content

Commit 23de6ea

Browse files
authored
Merge pull request #1793 from volta-cli/log-all-the-things
Update logger config to support all internal crates
2 parents bccce33 + fc44136 commit 23de6ea

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

crates/volta-core/src/log.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ const SHIM_WARNING_PREFIX: &str = "Volta warning:";
1515
const MIGRATION_ERROR_PREFIX: &str = "Volta update error:";
1616
const MIGRATION_WARNING_PREFIX: &str = "Volta update warning:";
1717
const VOLTA_LOGLEVEL: &str = "VOLTA_LOGLEVEL";
18-
const ALLOWED_PREFIX: &str = "volta";
18+
const ALLOWED_PREFIXES: [&str; 5] = [
19+
"volta",
20+
"archive",
21+
"fs-utils",
22+
"progress-read",
23+
"validate-npm-package-name",
24+
];
1925
const WRAP_INDENT: &str = " ";
2026

2127
/// Represents the context from which the logger was created
@@ -48,7 +54,13 @@ impl Log for Logger {
4854
}
4955

5056
fn log(&self, record: &Record) {
51-
if self.enabled(record.metadata()) && record.target().starts_with(ALLOWED_PREFIX) {
57+
let level_allowed = self.enabled(record.metadata());
58+
59+
let is_valid_target = ALLOWED_PREFIXES
60+
.iter()
61+
.any(|prefix| record.target().starts_with(prefix));
62+
63+
if level_allowed && is_valid_target {
5264
match record.level() {
5365
Level::Error => self.log_error(record.args()),
5466
Level::Warn => self.log_warning(record.args()),

0 commit comments

Comments
 (0)