1.1.2 • Published 1 year ago

@habibovulugbek/logger v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Logger for NestJS

Before installation

If you want to use Logger, you must install additional packages:

$ npm install --save @nestjs/common @habibovulugbek/logger

Getting started

HttpLoggerInterceptor

You can use HttpLoggerInterceptor in your main.ts file to represent your request and response.

// main.ts
import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import { HttpLoggerInterceptor } from '@habibovulugbek/logger'

async function bootstrap() {
  const app = await NestFactory.create(AppModule)
  app.useGlobalInterceptors(new HttpLoggerInterceptor())
  await app.listen(3000)
}

RpcLoggingInterceptor

You can use RpcLoggingInterceptor in your main.ts file to represent your request and response.

//main.ts

import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import { RpcLoggingInterceptor } from '@habibovulugbek/logger'

async function bootstrap() {
  const app = await NestFactory.createMicroservice(AppModule, {
    transport: Transport.TCP,
    options: {
      host: '127.0.0.1',
      port: 3000,
    },
  })
  app.useGlobalInterceptors(new RpcLoggingInterceptor())
  await app.listenAsync()
}
bootstrap()

Enjoy!

1.1.2

1 year ago

1.1.1

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago