Simple function logger in JS
This post was originally published on Coding Glamour.
Every now and then I end up in a code base where I don't have a clue
about the flow yet; like today when testing out the new keyboard application
that we're developing for Firefox OS. To see whether the flow is actually
sane I plug in a simple function logger that allows me to see which functions
are called and with what arguments.
Now you can take advantage of this by putting a call to this function on the first line of any function you want to trace:
When calling the a function, it will log the function name and an object with argument names and values:
Remember to disable "use strict" because accessing callee is not permitted anymore.
There are 4 comments on this article, read them on Coding Glamour.