0.67.0 • Published 3 months ago

@rnw-community/nestjs-rxjs-logger v0.67.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

NestJS RxJS logger

NestJS default logger wrapper for using with RxJS streams.

npm version npm downloads

Supported log levels

  • error - error$ RxJS operator
  • info - info$ RxJS operator
  • warn - warn$ RxJS operator
  • debug - debug$ RxJS operator
  • verbose - verbose$ RxJS operator

Configuration

Import NestJsRxJsLoggerModule into your module:

import { Logger, Module } from '@nestjs/common';
import { NestJsRxjsLoggerService } from '@rnw-community/nestjs-rxjs-logger';

@Module({
    imports: [NestJsRxJsLoggerModule],
    providers: [],
    exports: [],
})
export class MyModule {}

Inject NestJsRxjsLoggerService into your service:

import { Injectable } from '@nestjs/common';
import { NestJsRxjsLoggerService } from '@rnw-community/nestjs-rxjs-logger';
import { mapTo } from 'rxjs';

@Injectable()
export class MyService {
    constructor(private readonly logger: NestJsRxjsLoggerService) {}
}

Usage examples

Basic operators example

import { Injectable } from '@nestjs/common';
import { NestJsRxjsLoggerService } from '@rnw-community/nestjs-rxjs-logger';
import { mapTo } from 'rxjs';

@Injectable()
export class MyService {
    constructor(private readonly logger: NestJsRxjsLoggerService) {}

    loggerOperatorExample$(): Observable<true> {
        return of(true).pipe(this.logger.info$('My message', 'OtherContext'));
    }
}

Create stream example

import { Injectable } from '@nestjs/common';
import { NestJsRxjsLoggerService } from '@rnw-community/nestjs-rxjs-logger';
import { mapTo } from 'rxjs';

@Injectable()
export class MyService {
    constructor(private readonly logger: NestJsRxjsLoggerService) {}

    loggerCreateStreamExample$(): Observable<number> {
        return this.logger.create$('My message', MyService.name).pipe(mapTo(1));
    }
}

Set logger context

import { Injectable } from '@nestjs/common';
import { NestJsRxjsLoggerService } from '@rnw-community/nestjs-rxjs-logger';
import { mapTo } from 'rxjs';

@Injectable()
export class MyService {
    constructor(private readonly logger: NestJsRxjsLoggerService) {
        this.logger.setContext(MyService.name);
    }

    loggerOperatorExample$(): Observable<true> {
        return of(true).pipe(this.logger.info$('My message'));
    }

    loggerCreateStreamExample$(): Observable<number> {
        return this.logger.create$('My message').pipe(mapTo(1));
    }
}

License

This library is licensed under The MIT License.

0.67.0

3 months ago

0.66.0

3 months ago

0.65.2

4 months ago

0.65.3

4 months ago

0.64.0

5 months ago

0.65.0

5 months ago

0.63.0

5 months ago

0.62.3

5 months ago

0.62.1

6 months ago

0.62.0

7 months ago

0.62.2

6 months ago

0.59.3

7 months ago

0.55.0

7 months ago

0.59.6

7 months ago

0.59.4

7 months ago

0.59.5

7 months ago

0.56.0

7 months ago

0.60.0

7 months ago

0.57.2

7 months ago

0.57.3

7 months ago

0.57.0

7 months ago

0.57.1

7 months ago

0.54.12

10 months ago

0.61.0

7 months ago

0.53.0

1 year ago

0.51.0

1 year ago

0.52.3

1 year ago

0.54.0

1 year ago

0.52.0

1 year ago

0.50.0

1 year ago

0.49.2

1 year ago

0.49.0

1 year ago

0.43.0

2 years ago

0.48.0

2 years ago

0.46.0

2 years ago

0.44.0

2 years ago

0.42.0

2 years ago

0.42.1

2 years ago

0.47.0

2 years ago

0.43.1

2 years ago

0.45.0

2 years ago

0.43.2

2 years ago

0.41.0

2 years ago

0.38.2

2 years ago

0.38.1

2 years ago

0.38.0

2 years ago

0.36.1

2 years ago

0.36.0

2 years ago

0.34.0

2 years ago

0.32.1

2 years ago

0.38.3

2 years ago

0.32.0

2 years ago

0.40.0

2 years ago

0.39.0

2 years ago

0.37.0

2 years ago

0.35.1

2 years ago

0.35.0

2 years ago

0.33.0

2 years ago

0.31.0

2 years ago

0.20.0

2 years ago

0.19.0

2 years ago

0.19.1

2 years ago

0.11.0

2 years ago

0.13.0

2 years ago

0.15.0

2 years ago

0.17.0

2 years ago

0.17.1

2 years ago

0.30.0

2 years ago

0.29.0

2 years ago

0.27.2

2 years ago

0.27.1

2 years ago

0.27.0

2 years ago

0.25.0

2 years ago

0.23.1

2 years ago

0.23.0

2 years ago

0.27.4

2 years ago

0.27.3

2 years ago

0.21.0

2 years ago

0.18.1

2 years ago

0.18.2

2 years ago

0.18.3

2 years ago

0.18.4

2 years ago

0.12.0

2 years ago

0.12.1

2 years ago

0.14.0

2 years ago

0.14.1

2 years ago

0.16.0

2 years ago

0.14.2

2 years ago

0.18.0

2 years ago

0.28.0

2 years ago

0.26.1

2 years ago

0.26.0

2 years ago

0.24.2

2 years ago

0.24.1

2 years ago

0.24.0

2 years ago

0.22.0

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.0

3 years ago

0.7.5

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.3

3 years ago

0.7.0

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago