In my express.js project everything works fine, but having several routing files an other function files, I feel a bit like drowning in all the functions, not knowing which functions run, when, and by which caller.
For example, I have two functions that may run too many times in event loop: the router.use
which I see as a constructor to all related routes (from which I want to filter out some), and verify token function that should run only when certain conditions are met, such as API calls, or regular calls that detect admin cookie etc.
I'm trying to generate a log that can help me find which functions are called more than once and by which caller. Sort of like a map per event.
I use console.log
to see order and current call url when firing an event, and I also use node-inspector's breakpoints to see how many times functions like router.use
are called, but when manually following the functions in node-inspector, many node core files are involved in the process, which makes the task more tedious because I am interested to debug only my functions... and it doesn't let me see the bigger picture, more readable information on a zoomed out perspective.
What is the preferable method to generate such a log/report?