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.
A progressive Node.js framework for building efficient and scalable server-side applications.
A simple log decorator or (TypeScript) for Nest framework (node.js) unified approach for class and function logging.
You can install this package using NPM:
npm i --save @dmytropaduchak/nestjs-log
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> {}
}
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
For check eslint rules, use:
npm run lint
For auto fix all eslint bugs, use:
npm run lint:fix
Nest is MIT licensed.