0.0.7-alpha.2 • Published 2 years ago

@macrobe/logger v0.0.7-alpha.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

README

Logger for buzzguru API Services. The Logger uses Winston

Get started

Options

  • context - service name i.e. auth, defaults to api
  • env - current stage, defaults to 'local'
  • level - log level, defaults to 'silly',

How to Use

@Module({
    imports: [
        ...
        LoggerModule.registerAsync({
            useFactory: (config: ConfigService): ILoggerOptions => ({
                type: config.get<ILoggerType>('LOGGER_TYPE'),
                context: config.get('SERVICE_NAME'),
                env: config.get('NODE_ENV'),
                level: 'silly',
            }),
            inject: [ConfigService],
        })
@Controller()
export class AppController {
  constructor(
        ...
        private readonly loggerService: LoggerService,
    ) {}

  @Get()
  async get() {
    this.loggerService.log('Hello buzz');
  }
}