Add timed sections by Qix- · Pull Request #485 · debug-js/debug
This adds timed sections, similar to console.time() and console.timeEnd().
I understand completely if this isn't something you guys want added. However, it should be a non-breaking change.
If it is something you're interested in, I'll add docs to the readme :)
This works both in the browser and in Node.
Usage:
const debug = require('debug')('foo:bar'); const sec = debug.begin('section 1'); sec.mark('this is a marker'); sec.mark('it, too, shows the delta from the beginning of the section'); sec.end('finally, we can end the section'); // or simply sec.end();
As you'd expect, .mark() is entirely optional, and the arguments to .mark() and .end() are optional as well.
Arguments passed to .mark() and .end() are separated from the .begin() text with ::, and all formatting parameters are preserved as you'd expect - even in the browser:
The separation with :: is a trivial change, so if you don't like the way it looks or have a better idea on how to introduce the mark/end text to the existing arguments provided by .begin(), let me know and I can whip it up.

