I want to set npm debug namespaces dynamically as documented here.
My code in app.component.ts
is as follows:
import debug from 'debug'
ngAfterViewInit() {
console.log('BEFORE')
debug.enable('*')
const test = debug('test')
// debug.enable('*')
test('hello')
console.log('AFTER')
}
Sadly, I see no logging from debug. I only get the following logged to the browser console:
BEFORE
AFTER
I know I can set the DEBUG environment variable, but that is NOT dynamic and I want this to be dynamic.
PS I have had this problem for years now and it has stopped me using npm debug
but I would like to use it again!