Clone
11
Home
p-sw edited this page 2025-03-26 22:49:16 +00:00

Last updated: v3.3.1

NestLogged

NestLogged is a logging decorator set for NestJS. It provides simple way to remove logging from the function body in NestJS, so developer can focus on the "real" business code.

You can get logs with just a few simple decorators attached to the class, function, parameter.

Here is the key feature of NestLogged:

  • Initialize logger with simple decorator
  • Add scope to Logger
  • Print logs on function call and return with just a decorator
  • Log parameter values and return values as well
  • Track each request easily with unique request ID

Installation

$ npm install nestlogged

If you use Fastify:

$ npm install nestlogged-fastify

We made completely separate fastify package because we had to overwrite some of the decorators to make sure unique request has single id between middleware decorator and other logging decorator.

You can simply use nestlogged-fastify by replacing nestlogged.