开发者

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:

  1. Is there a built-in function to write log messages to the console?
  2. If not, is there a way to tell the Aptana debugger to ignore the specific throw in my log 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜