Skip to content

Parse process.env when debug is called rather than when it is required. #61

@danielchatfield

Description

@danielchatfield

Currently the environment variable is parsed when debug is required, this means that if the module wants to dynamically change the environment (for example in the presence of a --debug argument) then the require has to be done after this logic instead of at the top of the file, as is convention.

I think it would be better to parse the environment variable when debug() is first called as then modules which would like the extra flexibility can do the following and it will work with the modified env.

var debug = require('debug');

// environment changing logic

debug = debug('module');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions