1.0.2 • Published 5 years ago
@thorbens/logging v1.0.2
Description
This package provides simple logging as a typescript decorator.
Loggers can be injected via a decorator @InjectLogger()
or by calling the Logging.getLogger
method.
Every logger is associated with a name - therefore a named logger is only initiated once.
Use
class Foo {
// By default, the class name will be used to retrieve a logger.
// Use @InjectLogger(`foo`) to retrieve a named logger.
@InjectLogger()
private logger!: Logger;
public getLogger(): Logger {
return this.logger;
}
}
It is also possible to retrieve a logger via the Logging
class:
const logger = Logging.getLogger(`foo`);
To do
Allow passing of configuration via the decorator and to getLogger
call