nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.69k stars 7.63k forks source link

Can't disable RouterExplorer and RouterMapper logs #10955

Closed asantos00 closed 1 year ago

asantos00 commented 1 year ago

Is there an existing issue for this?

Current behavior

Currently a good part of my production logs are initializations of the application due to the number of logs that RouterMapper, RoutesResolver and RouterExplorer. I can't find a way to disable it

[12:34:17.909] INFO (27292):
    context: "RouterExplorer"
    message: "Mapped {/negotiations/:negotiationId/offers, POST} (version: 1) route"
[12:34:17.909] INFO (27292):
    context: "RoutesResolver"
    message: "OffersController {/offers} (version: 1):"
[12:34:17.909] INFO (27292):
    context: "RouterExplorer"
    message: "Mapped {/offers/:offerId, GET} (version: 1) route"
[12:34:17.909] INFO (27292):
    context: "RouterExplorer"
    message: "Mapped {/offers/:offerId/state, PATCH} (version: 1) route"
[12:34:17.909] INFO (27292):
    context: "RoutesResolver"
    message: "NegotiationsAdminController {/admin/negotiations} (version: 1):"

Minimum reproduction code

Any nestjs app

Steps to reproduce

No response

Expected behavior

Is there a way to disable these types of logs, or at least to intercept them?

Package

Other package

No response

NestJS version

9.2.1

Packages versions

[System Information]
OS Version     : macOS Monterey
NodeJS Version : v16.13.1
NPM Version    : 8.1.2

[Nest CLI]
Nest CLI Version : 9.1.5

[Nest Platform Information]
platform-express version : 9.2.1
event-emitter version    : 1.3.1
mapped-types version     : 1.2.0
schematics version       : 9.0.3
passport version         : 9.0.0
terminus version         : 9.1.4
swagger version          : 6.1.4
typeorm version          : 9.0.1
testing version          : 9.2.1
common version           : 9.2.1
config version           : 2.2.0
axios version            : 1.0.0
core version             : 9.2.1
jwt version              : 9.0.0
cli version              : 9.1.5

Node.js version

v16.13.1

In which operating systems have you tested?

Other

No response

micalevisk commented 1 year ago

:warning: We use GitHub Issues to track bug reports, feature requests and regressions

Try the following instead:

micalevisk commented 1 year ago

btw if you use another logger lib like the production-ready Pino (with nestjs-pino) you will be able to suppress such entries easily using Pino features. The native one was designed to be as simple as possible and extensible

micalevisk commented 9 months ago

how to disable initialization logging