JS Logger 1.0.1 - logParams

Note: This now has a new name, Console Wrapper, and has been moved to a Google project. Please go to http://www.talkapex.com/2011/01/console-wrapper-previously-js-logger.html for more information.

I’ve updated my JavaScript Console Logger package to include a new function called logParams. logParams will automatically log all the parameters in your function. This can save a lot of time since you don’t need to manually list all the parameters and it will detect any “extra” parameters.

Here’s an example of the code:


function myFn(px, py, pz){
$.console.logParams();

//do something as part of this function

}//myFn;

//Not required if using in APEX.
//If called from APEX it will detect if you are in debug mode
$.console.setLevel(‘log’);

//Call myFn with the correct amount of parameters
myFn(1,2,3);

//Call myFn with more than “expected” number of parameters
myFn(1,2,3,’hello’, ‘goodbye’);Which results in:

Note: by default the parameters groups are collapsed by I’ve expanded them for this demo

Download Javascript Console Logger $logger.1.0.1. For more information about this javascript library please read my original post: http://www.talkapex.com/2010/08/javascript-console-logger.html

Thanks to Dan McGhan for helping come up with this idea.