Skip to content

Commit

Permalink
Merge 2fb7d08 into c0127b1
Browse files Browse the repository at this point in the history
  • Loading branch information
Qix- committed Dec 19, 2018
2 parents c0127b1 + 2fb7d08 commit 26e0d0f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common.js
Expand Up @@ -143,7 +143,9 @@ function setup(env) {
}

function extend(namespace, delimiter) {
return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
newDebug.log = this.log;
return newDebug;
}

/**
Expand Down
8 changes: 8 additions & 0 deletions test.js
Expand Up @@ -70,6 +70,14 @@ describe('debug', () => {
const logBar = log.extend('bar', '');
assert.deepStrictEqual(logBar.namespace, 'foobar');
});

it('should keep the log function between extensions', () => {
const log = debug('foo');
log.log = () => {};

const logBar = log.extend('bar');
assert.deepStrictEqual(log.log, logBar.log);
});
});

describe('rebuild namespaces string (disable)', () => {
Expand Down

0 comments on commit 26e0d0f

Please sign in to comment.