Skip to content

Commit 5d67a12

Browse files
committed
Make default debug notice and error
1 parent 7c3be8e commit 5d67a12

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

registry/lib/debug.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,13 @@ function customLog() {
6161

6262
/*@__NO_SIDE_EFFECTS__*/
6363
function isEnabled(namespaces) {
64-
if (typeof namespaces !== 'string' || !namespaces || namespaces === '*') {
64+
if (namespaces === '*') {
6565
return true
6666
}
67+
if (typeof namespaces !== 'string' || !namespaces) {
68+
namespaces = 'notice,error'
69+
}
70+
const ENV = /*@__PURE__*/ require('./constants/env')
6771
const split = namespaces
6872
.trim()
6973
.replace(/\s+/g, ',')
@@ -78,8 +82,16 @@ function isEnabled(namespaces) {
7882
names.push(ns)
7983
}
8084
}
81-
if (names.length && !names.some(ns => !!getDebugJsInstance(ns).enabled)) {
82-
return false
85+
if (names.length) {
86+
const someEnabled = names.some(ns => {
87+
if (!ENV.DEBUG && (ns === 'error' || ns === 'notice')) {
88+
return true
89+
}
90+
return !!getDebugJsInstance(ns).enabled
91+
})
92+
if (!someEnabled) {
93+
return false
94+
}
8395
}
8496
return skips.every(ns => !getDebugJsInstance(ns).enabled)
8597
}

0 commit comments

Comments
 (0)