Databases Reference
In-Depth Information
JavaScript console wrapper
Martin Giffy D'Souza
has written the
Console Wrapper
utility. For additional
information, see
http://www.talkapex.com/2011/01/console-wrapper-
previously-js-logger.html
.
Console wrapper allows to view the debug information in a nice console window
within browsers. Most of the browsers are console-enabled (exception is the
Internet Explorer browser). The utility is designed to easily debug JavaScript
within applications. It allows developers to use the JavaScript console without
breaking anything.
The most common use of the console is the
console.log
command:
console.log('hello world');
Removing instrumentation code before going into production can be annoying,
especially if you need to debug it later on. To resolve this issue, Martin D'Souza
has created a console wrapper. This allows you to leave your debugging calls in
production code. Here are some features:
When running APEX in debug mode, the log level is automatically set.
Installation of the console wrapper
Installation steps of the JavaScript Console Wrapper are as follows:
1.
To download
$console_wrapper.js
, navigate to
http://code.google.com/p/js-console-wrapper/
.
2.
Add the
console_wrapper.js
in the page template.
The different levels can be deined as follows:
• Info
• Exception
• Error
• Log/debug
• Off
• Warn
Using the console wrapper, it is possible to set the debugging level, by issuing the
following command:
$.console.setLevel('log');