This is a live demo of the Console Wrapper. Project is hosted on Google: http://code.google.com/p/js-console-wrapper
To view the console output: - Firefox: F12 - Safari: Ctrl+Alt+C - Chrome: Ctrl+Shift+J - IE: Will not work but no errors should appear
For Examples span 1 span 2
function myFn(pA, pB){ $.console.logParams(); //do something as part of function }//myFn $(document).ready(function() { if (window.console) { //Enable logging mode $.console.setLevel('log'); // 2 ways of calling Console // *** Standalone *** $.console.group('*** Stand Alone ***'); $.console.log('Current log level: ', $.console.getLevel()); $.console.warn('This is a warning message'); $.console.groupEnd(); // *** jQuery Chained Function *** // assumes you have a <span class="red">...</span> tag $.console.group('*** jQuery Chained Function ***'); $('.red').log('Before Red').css({color:'red'}).log('After Red'); $.console.groupEnd(); // Warning for chained function $.console.group('*** jQuery Chained Function (warn) ***'); $('.red').log('warn','Before Red').css({color:'red'}).log('After Red'); $.console.groupEnd(); // *** logParams *** myFn(1,2,3); } else { // Console does not exist window.alert('Browser does not support "console" or must enable "console"'); } });