-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ad0e89
commit 424fbd5
Showing
7 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import debug from '../index.js'; | ||
|
||
const a = debug('name-one'); | ||
const b = debug('longer-name'); | ||
const c = debug('sth'); | ||
|
||
function workA() { | ||
a('doing some work here'); | ||
setTimeout(workA, Math.random() * 1000); | ||
} | ||
|
||
function workB() { | ||
b('doing some more work here'); | ||
setTimeout(workB, Math.random() * 1000); | ||
} | ||
|
||
function workC() { | ||
c('lots of uninteresting work here'); | ||
setTimeout(workC, Math.random() * 1000); | ||
} | ||
|
||
workA() | ||
workB() | ||
workC() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import debug from '../index.js'; | ||
|
||
const events = debug('events'); | ||
|
||
events.events.on('log', (scope, message) => { | ||
console.log('log in', scope, 'message is', message); | ||
}); | ||
|
||
events('Log a') | ||
events('Log b') | ||
events('Log c') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import debug from '../index.js'; | ||
|
||
const worker = debug('worker'); | ||
const workerA = worker.extend('a'); | ||
const workerB = worker.extend('b'); | ||
|
||
worker('doing some work here') | ||
workerA('doing some a work here') | ||
workerB('doing some b work here') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import debug from './index.js'; | ||
|
||
const foo = debug('foo'); | ||
const bar = foo.extend('bar'); | ||
const baz = bar.extend('baz'); | ||
|
||
function workFoo() { | ||
foo('working foo'); | ||
|
||
if (Math.random() > 0.5) { | ||
bar('working bar'); | ||
if (Math.random() > 0.5) { | ||
baz('working baz'); | ||
} | ||
} | ||
|
||
setTimeout(workFoo, Math.random() * 1000); | ||
} | ||
|
||
workFoo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import debug from '../index.js'; | ||
|
||
const longString = debug('long-string'); | ||
|
||
longString('This is a long string with new lines and some more stuff which should trigger wrapping but may not.\nThe point of this test is to make sure that new lines are split so that we get cleaner output on multiple lines.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import debug from '../index.js'; | ||
|
||
const a = debug('a'); | ||
|
||
a('hello heres some code: %o', { | ||
foo: 'bar', | ||
baz: 'qux', | ||
number: 1, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import debug from '../index.js'; | ||
|
||
const time = debug('time'); | ||
|
||
time.time('Starting'); | ||
setTimeout(() => { | ||
time.markTime('Interval'); | ||
setTimeout(() => { | ||
time.markTime('Interval and some\nnewlines\nhere\nlol'); | ||
setTimeout(() => { | ||
time.markTime('Interval'); | ||
time.endTime('Ending'); | ||
}, 1000); | ||
}, 1000); | ||
}, 1000); |