开发者

Live javascript debugging by recording function calls and parameters [duplicate]

开发者 https://www.devze.com 2023-02-09 05:02 出处:网络
This question already has answers here: Can I override the Javascript Function object to log all function calls?
This question already has answers here: Can I override the Javascript Function object to log all function calls? (6 answers) Closed 5 years ago.

Is there a debugging system that allows me to record javascript function calls and their parameters as they occur? this would allow me to trace and debug applications in live/client situations without the performance hit due to manual logging.

Edit: I'm not talking about manually calling functions using a 'console' window and viewing the results, or manually adding 't开发者_如何学Pythonrace' or 'log' commands into my javascript. I need it to work with any running javascript.


Can you override Function.prototype.call and retrieve arguments and arguments.callee?

This would have the effect of reporting on ALL functions and therefore being super verbose, but maybe you'd want to filter.

Then you have the question of how you want to report, perhaps with if (console) console.log


you could take a look at http://ajax.dynatrace.com/ajax/en/ - its IE only but pretty darn good, see this article by j. Resig : http://ejohn.org/blog/deep-tracing-of-internet-explorer/ > "..dynaTrace provides some information that I’ve never seen before – in any tool on any browser."


@Jenko if what you're looking for something similar to an IDE debugger, in that case Internet Explorer 8 and 9 have a built-in Developer Tools (press F12) and Chrome has Developer Tools as well. Both IE and Chrome allow you to set breakpoints in your code and step through it while it's running. Firefox has Firebug, which others have mentioned, and it too allows to set breakpoints and examine the execution of your code. Opera has Dragonfly (built-in) and has the same features as the other browsers.


As I was reading the answers and laughing at the duplicate answers of "You can use Firebug!" I realized.... you can use Firebug.

Seriously, it has a "profile" command that does exactly what you are asking for. Safari and Chrome have this feature so you can check in there as well. IE8/9 has a "profiler" tool which is similar (but I don't know if it can be called from JavaScript with console.profile())

This will give you accurate times since any code and logging you add would also afect the actual performance. And because this feature is in the top browsers, you get a reasonable amount of data.

Live javascript debugging by recording function calls and parameters [duplicate]


I've found fireflow: https://addons.mozilla.org/en-us/firefox/addon/fireflow/ incredible helpful.


If you're talking about browser-side javascript dedub you can use Firebug, which is an excellent tool.

http://getfirebug.com/

Here you can find a step-by-step tutorial:

http://www.digitalmediaminute.com/screencast/firebug-js/


Yes. all major browsers have a debugger built-in (IE, Chrome, Safari), or available as a add-on (Firebug for Firefox).


Firebug is good for this. Or you can use Google Chrome's built-in debugger as well.


for Firefox Firebug for IE deeloper tool for chrome built-in debugger is nice to use


Arguably the best online Javascript Code Quality Controll is JSLint. It not only checks code for errors, it improves the coding style of programmes entirely<< this is the reason the author has made it in the first place. My 0,02 $

http://www.jslint.com/

0

精彩评论

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