1.0.8 β€’ Published 10 months ago

@dmytropaduchak/nestjs-log v1.0.8

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

πŸ‡ΊπŸ‡¦ HELP UKRAINE

GOOD EVENING WE ARE FROM UKRAINE.

We fight for democratic values, for freedom, for our future. We need your support. There are dozen ways to help us, JUST DO IT.

Build Status Coverage Status NPM Version

NestJS Log

A simple log decorator or (TypeScript) for Nest framework (node.js) unified approach for class and function logging.

Installation

You can install this package using NPM:

npm i --save @dmytropaduchak/nestjs-log

How use

Example with simple implementation:

import { Log } from '@dmytropaduchak/nestjs-log';

class Service {
  @log() async test(): Promise<void> {}
}

Example with custom looger implementation:

import { LoggerService } from '@nestjs/common';
import { Log } from '@dmytropaduchak/nestjs-log';

class CustomLogger extends LoggerService {}

const logger = new CustomLogger();

class Service {
  @log({ logger }) async test(): Promise<void> {}
}

Example with transform logging data implementation:

import { LoggerService } from '@nestjs/common';
import { Log } from '@dmytropaduchak/nestjs-log';

class MyLogger extends LoggerService {}

const logger = new MyLogger();

const transform = (key, value) => [key, value];

class Service {
  @log({ logger, transform }) async test(): Promise<void> {}
}

Example with override default log options implementation:

import { Log } from '@dmytropaduchak/nestjs-log';

const timestamp = true;
const prefix = 'Test';

class Service {
  @log({ prefix, timestamp }) async test(): Promise<void> {}
}

Unit testing

For run unit tests, use:

npm run test

All unit test report you can find at report/ folder.

For run test at watch mode, use:

npm run test:dev

Linting

For check eslint rules, use:

npm run lint

For auto fix all eslint bugs, use:

npm run lint:fix

License

Nest is MIT licensed.

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago