1.0.2 • Published 5 years ago

@thorbens/logging v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

Build Status codecov

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

1.0.2

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago