@motech-development/logger
v1.0.7
Published
NestJS application logger
Downloads
2
Readme
@motech-development/logger
NestJS application logger
A Morgan logger for NestJS.
Installation
Add @motech-development/logger
as a dependency.
# Yarn
yarn add @motech-development/logger
# NPM
npm i @motech-development/logger
Usage
Add the LoggerModule
to your application.
import { LoggerModule } from '@motech-development/logger';
@Module({
imports: [LoggerModule],
})
class AppModule {}
This will automatically begin to log all network requests in your application and provide the logger to use in your application.
import { Logger } from '@motech-development/logger';
@Injectable()
class MyService {
private readonly logger = new Logger();
public myMethod(): void {
this.logger.log('Testing, 123');
}
}
// Or...
@Injectable()
class AnotherService {
constructor(private readonly logger: Logger) {}
public myMethod(): void {
this.logger.debug('Testing, 123');
}
}