-
Notifications
You must be signed in to change notification settings - Fork 942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debug.enable() NOT dynamic #871
Comments
It might be the case, honestly. Using You should be using the
One of those situations that seems simple until you go to implement it and try to make it performant and realize you're slowing everyone down when you try to simplify things. |
Thanks for your quick response @qix. Please Note that since my original post had not been responded to, I re-worded it (removing some off-topic questions), and updated it with my latest results (I actually got it working)!
FYI: When I used the term "rudimentary" (above), I was not implying that it was easy to implement, rather that it's usage was easy (not understanding how I messed it up :-) BackgroundCertainly in a development environment it is feasible to use the DEBUG env var. However I am working on a server-based administrative utility that provides the ability to dynamically alter the filters in a production deployment (without re-starting the server). In this context, the Thoughts? Regarding My Problem - NOW FIXED!For what it is worth, I just now resolved my problem and it is working very well :-) | As I mentioned, I am working with a MonoRepo. I analyzed it to insure there were consistent top-level npm versions of the debug lib (across all the packages of my MonoRepo). In my case I found a "rouge" top-level npm debug lib installed on my server that was sorely out-of-date. I'm not exactly sure where it came from (I did not install it). I suspect it originated from one of my dev-dependencies that in-turn uses the debug lib. Bottom line is, once I explicitly installed the latest debug lib in all my MonoRepo packages, everything started working (both client and server). I can even enable logs of other packages (by using the "*" filter) ... for example socket.io. Mine Field Future?Regarding the Thoughts? ThanksThanks in advance, for your time and response. |
Yes, quite a few issues are open about it. Checked the pin roadmap issue #656 which mentions the various pieces of the Unfortunately I'm all too familiar with the problems of |
I am new to debug logger and I thank you for your awesome utility.
In my experience, using
debug.enable('myProj:myModule:myFn')
does NOT dynamically impact the logging filters in the current process (in either the browser or node). It merely resets the DEBUG env var (or the browser's localStorage.debug). The process must then be re-started for it to take effect.I am using the latest 4.3.3 release.
I must be doing something wrong, as the README docs clearly state that
enable()
dynamically resets the filter.The ability to dynamically change the logging filters (without restarting the process) is a crucial feature for production code, especially in a node/server environment.
I have searched both the debug project issues -and- stackoverflow with no luck. I did find a number of
enable()
issues, but none that seemed to match my problem.One thing I considered is I am creating my log instances in a "module scope", so my probes live a lifetime in the process. Is this an incorrect usage? Should I be creating log instances in a function scope, so they are re-created on each function invocation? I tried a quick test of this, and it seemed the results were the same (still no dynamic behavior).
From an application perspective, this feature would seem to be very rudimentary ... so as I stated, I must be doing something wrong.
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: