File tree Expand file tree Collapse file tree 2 files changed +16
-16
lines changed
Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,13 @@ const SHIM_WARNING_PREFIX: &str = "Volta warning:";
1515const MIGRATION_ERROR_PREFIX : & str = "Volta update error:" ;
1616const MIGRATION_WARNING_PREFIX : & str = "Volta update warning:" ;
1717const 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+ ] ;
1925const 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 ( ) ) ,
You can’t perform that action at this time.
0 commit comments