abs-nestjs-logger-service
v0.0.1
Published
`LoggerService` is a custom logging service that can be used in a NestJS application to log messages with different levels of severity (e.g., debug, info, warn, error).
Readme
LoggerService Documentation
LoggerService is a custom logging service that can be used in a NestJS application to log messages with different levels of severity (e.g., debug, info, warn, error).
Installation
To install the necessary dependencies, run:
npm install abs-nestjs-logger-serviceUsage with NestJS
- Import the LoggerService into your module:
import { Module } from '@nestjs/common';
import { LoggerService } from 'abs-nestjs-logger-service';
@Module({
providers: [LoggerService],
exports: [LoggerService],
})
export class AppModule {}- Inject the LoggerService into your service or controller:
import { Injectable } from '@nestjs/common';
import { LoggerService } from 'abs-nestjs-logger-service';
@Injectable()
export class SomeService {
constructor(private readonly logger: LoggerService) {}
someMethod() {
this.logger.debug('Debug message');
this.logger.info('Info message');
this.logger.warn('Warning message');
this.logger.error('Error message');
}
}- Use the appropriate logging methods (debug, info, warn, error) to log messages with different levels of severity.
