Log to Aptana console when debugging JavaScript
I'm using Aptana Studio 3 to debug JavaScript code. It is a simple HTML page which is displayed in Internet Explorer.
I want to write log messages to the Aptana Console view. I have tried to use开发者_开发技巧 the following log function:
function log(message) {
setTimeout(function() { throw new Error(message);}, 0);
}
This works, but when debugging the page, Aptana stops because of the throw
. I have two questions:
- Is there a built-in function to write log messages to the console?
- If not, is there a way to tell the Aptana debugger to ignore the specific
throw
in mylog
function above?
Solutions should work in IE8 and above. Switching to another browser is not possible.
The Developer Tools (F12) of IE 8 and above bring logging support to the Internet Explorer. This feature is described here. Simple logging is possible with:
console.log('my message');
Note that the console
feature is not available until you start the developer tools.
However, this will display nothing within Aptana, but with the IE console you are able to see log messages.
精彩评论