Console1? How about
may be even
log.red("args"). Well, that is how I started on
colorlog.js. But now it has
become a little more than that.
This helps with managing logging also. For example, note that we
console.log, but rather just
log. Here is how it
App.afunc(), that gives (in Chrome).
Well, that doesn’t explain how
App.log came about, but wait. Note
how we can conveniently add a prefix for all the logs called from this
module. Well, its not just that. Replace
App.log.mute and logs from the module won’t be shown. Oh, and you
App.log also, if you don’t need the prefix.
Well, that is almost it. Except for a small function
log.instrument_fns. Call it on an hash of functions, and every time
one of those functions is called, a log will be shown in console, in
red. I know, silly. Please only use it for small debug sessions. It
should never go out in the wild.
Change things as you like, after copying the code from below. And yes,
if you look at the code below, you will know how
App.log came about.
One of the big downsides with this library, is the line number mess.
Note: cross-posting from ciju’s blog
In the days before, I used to do
console.log("********", "actual arguments");or something like that. ↩