Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 'trace' or 'log' commands into my javascript. I need it to work with any running javascript.

like image 597
Robin Rodricks Avatar asked Feb 07 '11 13:02

Robin Rodricks


People also ask

What two methods can be used to test JavaScript values when debugging?

The console. log() is a good way to debug errors but setting breakpoint is a faster, efficient and better method. In this method, Breakpoints are set in code which stops the execution of code at that point so that the values of variables can be examined at that time.

Why is JavaScript so hard to debug?

What makes JavaScript great is also what makes it frustrating to debug. Its asynchronous nature makes it easy to manipulate the DOM in response to user events, but it also makes it difficult to locate problems.

Can JavaScript be debugged?

But fortunately, all modern browsers have a built-in JavaScript debugger. Built-in debuggers can be turned on and off, forcing errors to be reported to the user. With a debugger, you can also set breakpoints (places where code execution can be stopped), and examine variables while the code is executing.


2 Answers

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

like image 56
Joe Hanink Avatar answered Oct 14 '22 14:10

Joe Hanink


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."

like image 27
zack Avatar answered Oct 14 '22 13:10

zack