mirror of
https://github.com/debug-js/debug.git
synced 2025-12-08 20:59:48 +00:00
Split log() into 2 methods: formatArgs() and log(), allowing log to be overridden on a per-namespace or global level. Global log settings trump per-namespace settings.
30 lines
587 B
HTML
30 lines
587 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>debug()</title>
|
|
<script src="../dist/debug.js"></script>
|
|
<script>
|
|
// type debug.enable('*') in
|
|
// the console and refresh :)
|
|
|
|
var a = debug('worker:a');
|
|
var b = debug('worker:b');
|
|
|
|
// set all output to go via console.info
|
|
// instead of console.log
|
|
debug.log = console.info.bind(console);
|
|
|
|
setInterval(function(){
|
|
a('doing some work');
|
|
}, 1000);
|
|
|
|
setInterval(function(){
|
|
b('doing some work');
|
|
}, 1200);
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
</body>
|
|
</html>
|