tropo / PhonoSDK

Phono.com - The jQuery Phone API
http://phono.com
Other
131 stars 63 forks source link

Added some log management in an effort to tame Phono's logs #40

Closed nkcmr closed 10 years ago

nkcmr commented 10 years ago

So, the current logging behavior of Phono is very annoying to develop around. Having to sort through the Phono logs to find my logs is a practice in futility. So I poked around the code and found a currently in place system that identifies log items. So I used that and created a public API for setting the loglevel. So, setting the loglevel can be done like so:


var a = $.phono({
    apiKey: "abcd"
});

a.setLogLevel("< ALL | TRACE | DEBUG | INFO | WARN | ERROR | FATAL | OFF >");
a.getLogLevel(); // -> "WARN" (The default level)

The only thing I can't seem to figure out how to do without messing with the application structure is set the log level using the initial $.phono configuration like this:

var a = $.phono({
    apiKey: "abcd",
    loglevel: "INFO"
});

a.getLogLevel(); // -> "INFO"

If the maintainers of Phono can figure out how to do that, the logging would be perfect.

Feel free to edit any of my changes before pulling to master, but the logging really needs to be tamed.

Thanks Phono team!

steely-glint commented 10 years ago

Great, thanks for the help, you've saved me some work I was not looking forward to this sprint !