Open wethinkagile opened 8 years ago
In ES6/Typescript you could make use of the constructor name property:
export class AppModule {
constructor() {
Minilog.suggest.defaultResult = false; // Enable Whitelist Mode
Minilog
.suggest
.clear()
.allow(this.constructor.name, 'warn');
Minilog.enable();
let logger = Minilog(this.constructor.name);
logger.debug('will not be displayed');
logger.info('will not be displayed');
logger.log('will not be displayed');
logger.warn('a warning will be displayed');
logger.error('an error will be displayed');
}
}
I created a running example at http://plnkr.co/edit/4JsuWFFpMFpT4v8eNSHs?p=preview.
To white list, we do:
Would if be possible to target angular2 components to steer the logging on the granular level like with node js modules?