Giter VIP home page Giter VIP logo

Comments (6)

kamilmysliwiec avatar kamilmysliwiec commented on May 22, 2024 1

Option to disable logging.

I would say that option to override logger might be useful as well.

from terminus.

weeco avatar weeco commented on May 22, 2024 1

I am using a custom logger as I got to log all messaages in JSOn format. I can confirm that this works :).

from terminus.

BrunnerLivio avatar BrunnerLivio commented on May 22, 2024

Terminus already supports to override the logger, so this should be doable.
As you can see I just took the default NestJS logger

private readonly logger = new Logger(TerminusBootstrapService.name, true);

But I can make this configurable in the module option like so, if that is suitable for you:

{
  logger: (message) => myawesomelogger.log(message),
  endpoints: [
    {
      url: '/health',
      healthIndicators: [
        async () => catHealthIndicator.isHealthy('cat'),
      ],
    },
  ],
}

In case the user does not define any logger, I guess it should take the nestjs logger

from terminus.

JAZZ-FROM-HELL avatar JAZZ-FROM-HELL commented on May 22, 2024

@BrunnerLivio Thanks for the clarification. I'm trying to avoid this logging in my health check unit tests. But even when defining a test module with a TestingLogger as follows, Terminus is still logging to console.

const module:TestingModule = await Test.createTestingModule({ imports: [MyModule], }) .setLogger(new TestingLogger()) .compile();

I'm not sure how is it depending on NestJS DI if it instantiates its own logger:

private readonly logger = new Logger(HealthCheckService.name);

Shouldn't it be injected?

from terminus.

JAZZ-FROM-HELL avatar JAZZ-FROM-HELL commented on May 22, 2024

@BrunnerLivio I'm still having the above issue.

from terminus.

BrunnerLivio avatar BrunnerLivio commented on May 22, 2024

@JAZZ-FROM-HELL Please create a new issue for it

from terminus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.