File tree 2 files changed +11
-1
lines changed 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,9 @@ function setup(env) {
143
143
}
144
144
145
145
function extend ( namespace , delimiter ) {
146
- return createDebug ( this . namespace + ( typeof delimiter === 'undefined' ? ':' : delimiter ) + namespace ) ;
146
+ const newDebug = createDebug ( this . namespace + ( typeof delimiter === 'undefined' ? ':' : delimiter ) + namespace ) ;
147
+ newDebug . log = this . log ;
148
+ return newDebug ;
147
149
}
148
150
149
151
/**
Original file line number Diff line number Diff line change @@ -70,6 +70,14 @@ describe('debug', () => {
70
70
const logBar = log . extend ( 'bar' , '' ) ;
71
71
assert . deepStrictEqual ( logBar . namespace , 'foobar' ) ;
72
72
} ) ;
73
+
74
+ it ( 'should keep the log function between extensions' , ( ) => {
75
+ const log = debug ( 'foo' ) ;
76
+ log . log = ( ) => { } ;
77
+
78
+ const logBar = log . extend ( 'bar' ) ;
79
+ assert . deepStrictEqual ( log . log , logBar . log ) ;
80
+ } ) ;
73
81
} ) ;
74
82
75
83
describe ( 'rebuild namespaces string (disable)' , ( ) => {
You can’t perform that action at this time.
0 commit comments