* `formatArgs()` gets passed the args Array directly
Rather than working on `arguments`. The Node.js version
was for some reason turning the arguments into an Array
again so it was happening twice! This should make things
faster overall.
* whitespace
* rename `Readme.md` to `README.md`
* refactor the `debug()` constructor a bit
Now, debug instances are hot-enabelable. That is, you can
toggle the `debug.enabled` boolean on instances to enable
or disable an instance. There is still no global version of
this functionality.
Now all instances get a `useColors` and `colors` property,
even disabled ones, in case they get enabled later on. Boot-up
time impact should be negligible.
* node: allow configurable `util.inspect()` options
Via env variables by default. So to get more object depth,
you pass the `DEBUG_DEPTH=10` env var.
For the `showHidden` option, you set `DEBUG_SHOW_HIDDEN=on`.
See the Node.js docs for the complete list of `util.inspect()` options:
https://nodejs.org/api/util.html#util_util_inspect_object_options
* README: document inspect env variables
There is a chance that there may be circular references in the Object which will cause the debug message to throw an exception. If the exception is not handled on the application level this will cause node to crash. As a debug library, errors in here should not have such a serious impact on the application.
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.
On Node.js, if you set a process.env field to either null or undefined,
it gets cast to string 'null' or 'undefined'.
For debug, this means that if you don't have DEBUG set, it will get set
to the string 'undefined'. There are other modules (like
node-rest-client) which use the DEBUG environment variable that will
start spewing debug output when you don't want it to.
Before the "%c" CSS color value was potentially being
inserted into the wrong place in the arguments array,
which would throw the formatting off in the Console.