0.0.1 • Published 4 years ago
@ramble-inc/nest-logger v0.0.1
@ramble-inc/nest-logger
Getting Started
Installation
Usnig yarn
yarn add @ramble-inc/nest-logger
or using npm
npm i @ramble-inc/nest-logger
Basic Usage
See nest-winston README.
Use Interceptor
Instantiate LoggingInterceptor
import { LoggingInterceptor } from '@ramble-inc/nest-logger';
const interceptor = new LoggingInterceptor({
// winston createLogger option
// see: https://github.com/winstonjs/winston
};
Bind LoggingInterceptor
to NestJS controller or method. In a controller
import { LoggingInterceptor } from '@ramble-inc/nest-logger';
@Controller('cat')
@UseInterceptors(new LoggingInterceptor())
export class CatController {}
or use it as a global interceptor. In main.ts
const app = await NestFactory.create(AppModule);
app.useGlobalInterceptors(new LoggingInterceptor());
0.0.1
4 years ago