klaudiosinani / signale

Highly configurable logging utility
MIT License
8.93k stars 232 forks source link

Conditional logging based on scope #102

Open OmgImAlexis opened 4 years ago

OmgImAlexis commented 4 years ago

Is your feature request related to a problem? Please describe. With larger applications it can be easier to have just a single scope logging while you debug, etc.

Describe the solution you'd like

log.update({ scope: 'a:b:c' }); // Only a:b:c scope
log.update({ scope: 'a:*' }); // `a` and all child scopes
log.update({ scope: '*' }); // Default value

The suggested way to use this would be like so.

if (process.env.DEBUG) {
    log.update({ scope: process.env.DEBUG });
}

Additional context Essentially I want the namespace filter debug has.

Oxicode commented 4 years ago

+1