The core libraries that come bundled with the Node binary are written in JavaScript, which means we can debug them the same way we debug our own code. This level of introspection means we can understand internal mechanics to a fine level of detail.
Let's use Devtools to pick apart how util.debuglog works.
We'll run our code we prepared in the Getting ready section like so (Node 8+):
$ NODE_DEBUG=timer node --inspect-brk index.js
Or if we're using Node 6.3.0+, use the following:
$ NODE_DEBUG=timer node --debug-brk --inspect index.js
Now if we navigate to chrome://inspect, click the inspect link ...