hemerajs / fastify-graceful-shutdown

Gracefully shutdown fastify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logger.flush is not a function

magiclen opened this issue · comments

Problem

When setting Fastify's logger option to false, an error is thrown when Fastify is terminated. The error message is TypeError: logger.flush is not a function.

Steps to Reproduce

  1. Set Fastify's logger option to false in the configuration.
  2. Start the Fastify app and use ctrl + c to cancel it.
  3. Observe the error thrown referencing fastify-graceful-shutdown/index.js:45:14.

We don't expect that someone disables the logger. It is stated in the README that we rely on it. I'd open an issue on fastify. The best solution would be to enable a noop implementation when logger: false instead of dealing with undefined.