File tree Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,7 @@ function getDebugJsInstance(namespace) {
27
27
if (
28
28
! ENV . DEBUG &&
29
29
ENV . SOCKET_CLI_DEBUG &&
30
- // Ignore 'inspect' namespace by default.
31
- namespace !== 'inspect'
30
+ ( namespace === 'error' || namespace === 'notice' )
32
31
) {
33
32
debugJs . enable ( namespace )
34
33
}
@@ -61,13 +60,11 @@ function customLog() {
61
60
62
61
/*@__NO_SIDE_EFFECTS__ */
63
62
function isEnabled ( namespaces ) {
64
- if ( namespaces === '*' ) {
63
+ if ( typeof namespaces !== 'string' || ! namespaces || namespaces === '*' ) {
65
64
return true
66
65
}
67
- if ( typeof namespaces !== 'string' || ! namespaces ) {
68
- namespaces = 'notice,error'
69
- }
70
- const ENV = /*@__PURE__ */ require ( './constants/env' )
66
+ // Namespace splitting logic is based the 'debug' package implementation:
67
+ // https://github.com/debug-js/debug/blob/4.4.1/src/common.js#L169-L173.
71
68
const split = namespaces
72
69
. trim ( )
73
70
. replace ( / \s + / g, ',' )
@@ -82,16 +79,8 @@ function isEnabled(namespaces) {
82
79
names . push ( ns )
83
80
}
84
81
}
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
- }
82
+ if ( names . length && ! names . some ( ns => getDebugJsInstance ( ns ) . enabled ) ) {
83
+ return false
95
84
}
96
85
return skips . every ( ns => ! getDebugJsInstance ( ns ) . enabled )
97
86
}
You can’t perform that action at this time.
0 commit comments