3.0.0 • Published 9 months ago

@trxn/nestjs-core v3.0.0

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
9 months ago

Nest JS - Core

This library regroups some utilities that is used accross nestjs packages

Logger

You can find a LoggerModule that export a LoggerService. This module use the Logger token from @nestjs/common to let you access directly from your DI at the nestjs logging system. Under the hood the LoggerService extends the Logger of nestjs and format correctly your messages.

import { LoggerModule } from '@trxn/nestjs-common';

import { MyService } from './my-service.service';

@Module({
  imports: [LoggerModule],
  providers: [MyService],
})
export class MyApp {}
import { Injectable, Logger } from '@nestjs/common';

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

  helloWorld() {
    this.logger.log('Hello World');
  }
}

If you need to access to more functionality of the LoggerService like the setContext or setMetadata you will need to tell to typescript what interface is used under the hood by the Logger token.

import { Inject, Injectable, Logger } from '@nestjs/common';

@Injectable()
export class MyService {
  constructor(@Inject(Logger) private readonly logger: LoggerService) {
    this.setContext(MyService.name);
    this.setMetadata({ foo: 'bar' })
  }

  helloWorld() {
    this.logger.log('Hello World');

    // Updating the context
    this.logger.log('Hello World', 'One time override context');

    // Updating the context and add more metadata
    this.logger.log('Hello World', { bar: 'foo' }, 'One time override context');

    // Override the metadata
    this.logger.log('Hello World', { foo: 'foo' });
  }
}

This logger is intended to work with the winston logger to be able to output correctly into the console in development and in an ecs format in production.

@see @trxn/nestjs-winston library for more information.


TODO: write some documentation on what are inside this package

This package contains the core utilities for our nestjs backend.

2.2.7

10 months ago

3.0.0

9 months ago

2.2.5

11 months ago

2.2.1

11 months ago

2.2.0

12 months ago

2.2.3

11 months ago

2.2.2

11 months ago

2.2.4

11 months ago

2.1.22-next.5

12 months ago

2.1.22-next.3

12 months ago

2.1.22-next.4

12 months ago

2.1.22-next.1

12 months ago

2.1.22-next.2

12 months ago

2.1.22-next.0

12 months ago

2.1.9

1 year ago

2.1.12

1 year ago

2.1.10

1 year ago

2.1.11

1 year ago

2.1.4

1 year ago

2.1.6

1 year ago

2.1.5

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.1.0-next.1

1 year ago

2.1.0-next.0

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.3

1 year ago

2.1.0

1 year ago

2.0.11-next.1

1 year ago

2.0.11-next.0

1 year ago

2.0.11-next.3

1 year ago

2.0.11-next.2

1 year ago

2.0.13

1 year ago

2.0.11

1 year ago

2.0.12

1 year ago

2.0.9

1 year ago

2.0.10

1 year ago

2.0.8

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.0-next.2

1 year ago

2.0.0-next.0

1 year ago

2.0.0-next.1

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.65.13-next.4

1 year ago

1.65.13-next.5

1 year ago

1.65.11-beta.3

1 year ago

1.65.3

1 year ago

1.65.13-next.2

1 year ago

1.65.4

1 year ago

1.65.5

1 year ago

1.65.13-next.8

1 year ago

1.65.6

1 year ago

1.65.11-next.0

1 year ago

1.65.7

1 year ago

1.65.13-next.6

1 year ago

1.65.8

1 year ago

1.65.13-next.7

1 year ago

1.65.9

1 year ago

1.65.10

1 year ago

1.65.12

1 year ago

1.65.11

1 year ago

1.65.13-next.0

1 year ago

1.65.11-beta.0

1 year ago

1.65.13-next.1

1 year ago

1.65.11-beta.2

1 year ago

1.65.11-beta.1

1 year ago

1.65.2

1 year ago