You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd love to hear your thoughts about an optional function stack trace that simple tracks the names of a function and simply pops it when it finishes.
I think it's rather easy to add external functions functionPush (or fPush) / functionPop (or fPop) with fPush having the argument of a string (name of function).
Those names need to be stored in an array and should be added to the namespace* whenever a debug in that function is called.
To not break the current pattern, the functionname stack can be concatted with a simple -> so you still call you debug from the cli like DEBUG=test:run and have results like: *test:run->funcA* Hello from funcA
Function a would look like this:
function funcA() {
debug.fPush('funcA');
debug('Hello from funcA');
debug('fPop');
}
This allows a developer to see the live stacktrace if you want to.
The drawback is obvious though - you have to take care of the push and pop.
But the advantages might overweight.
If you like this idea, I'll add it and PR it to you.
Any thoughts?
Or simply added to the output when a debug is called. I don't think string operations left and right are a good way.
The text was updated successfully, but these errors were encountered:
Hi,
I'd love to hear your thoughts about an optional function stack trace that simple tracks the names of a function and simply pops it when it finishes.
I think it's rather easy to add external functions functionPush (or fPush) / functionPop (or fPop) with fPush having the argument of a string (name of function).
Those names need to be stored in an array and should be added to the namespace* whenever a debug in that function is called.
To not break the current pattern, the functionname stack can be concatted with a simple
->
so you still call you debug from the cli likeDEBUG=test:run
and have results like:*test:run->funcA* Hello from funcA
Function a would look like this:
This allows a developer to see the live stacktrace if you want to.
The drawback is obvious though - you have to take care of the push and pop.
But the advantages might overweight.
If you like this idea, I'll add it and PR it to you.
Any thoughts?
The text was updated successfully, but these errors were encountered: