Skip to content

debug.enable() NOT dynamic #871

Closed
Closed
@KevinAst

Description

@KevinAst

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionThis issue asks a question or requests usage support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions