Before I proceed I must warn you I am the author of the logging library I am using, so there is a tiny possibility that I might be biased. Very tiny :)
Basically ulog is debug meets loglevel meets the console. It works in Node JS and all major browsers (even old ones!)
It started out because using console directly is basically VERBOTEN. Because some browsers simply don't support it and will crash your code. Also you need to remove these statements afterwards etc. Making logging difficult and error prone. So it started as a tiny shim that just makes sure that your code never crashes or fails whether console is available or not.
I then decided I wanted log level support so I added that. And then I discovered debug, which is GREAT, and I decided to copy those features I loved about that.
var ulog = require('ulog')
var log = ulog('my-module')
log('Formatted message (at debug level)')
log('warn', 'Formatted message (at warning level)')
Yields (on browsers)
21:23:24 .03 my-module Formatted message (at warning level)
Now is the perfect time as I am trying to perfect v2 currently. So if you want to try this, please install the beta and let me know:
npm install --save ulog@beta
Or you can use v1, but that version is more limited in features:
npm install --save ulog
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.