Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iamnnort/nestjs-logger

Logger module for NestJS - Simple - Informative - Pretty
https://github.com/iamnnort/nestjs-logger

Last synced: 10 days ago
JSON representation

Logger module for NestJS - Simple - Informative - Pretty

Awesome Lists containing this project

README

        

## Info

Logger module for NestJS - Simple - Informative - Pretty

## Installation

```bash
yarn install @iamnnort/nestjs-logger
```

## Usage

```javascript
// app.ts
import { Module } from '@nestjs/common';
import { LoggerModule } from '@iamnnort/nestjs-logger';

@Module({
imports: [LoggerModule],
})
export class AppModule {}

// index.ts
import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import { AppModule } from './app';
import { LoggerService } from '@iamnnort/nestjs-logger';

async function bootstrap() {
const app = await NestFactory.create(AppModule, {
bufferLogs: true,
});

app.useLogger(new LoggerService());

await app.listen(3000);
}

bootstrap();
```

## Output

```bash
[System] Application is starting...
[System] Application started.
[System] [Request] POST /echo {"greeting":"hello"}
[System] [Response] POST /echo {"greeting":"hello"} 200 OK
```

## License

This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.