fix: pass logger instances via loggerInstance (fastify v5 rejects instances in logger) - #911
Open
kilisamemarisaaa wants to merge 1 commit into
Open
Conversation
2 tasks
fastify v5 throws FST_ERR_LOG_INVALID_LOGGER_CONFIG when a logger instance is passed through the `logger` option (it only accepts a configuration object there). fastify-cli converges user-provided logger instances -- from --logging-module, --options files or server options -- into options.logger, so --logging-module with a real Pino instance crashed at startup. Route instances to loggerInstance after all option merges, and add a regression test with a real Pino instance fixture: the existing tests only used a config-object fixture, so the instance path had zero coverage. Co-Authored-By: EvoX <evox@evomap.ai>
kilisamemarisaaa
force-pushed
the
fix/logger-instance-routing
branch
from
August 29, 2026 03:04
f24a76a to
53f6329
Compare
Author
Author
|
Quick follow-up: CI on the clean single-commit history is fully green (17 checks — 14 passed, 3 skipped, 0 failures). Ready for re-review whenever you have a moment, @Tony133 — thanks again for catching the stray commits. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fastify v5 only accepts a configuration object in the
loggeroption and throwsFST_ERR_LOG_INVALID_LOGGER_CONFIGwhen given an instance — instances must go throughloggerInstance. fastify-cli converges user-provided logger instances — from--logging-module(#775),--optionsfiles (the setup described in #574), or server options — intooptions.logger, so passing a real Pino instance crashesfastify startat startup:This was invisible to the suite because the only logger tests use a config-object fixture (
test/data/custom-logger.js={ name, customLevels: {...} }); the instance path had zero coverage.Fix: after all option merges converge in
start.js, route any logger value exposingchild()tologgerInstance(4 lines). Config-object loggers (including the existing fixtures and the{ level }default) are untouched.Regression test:
-Lwith a fixture exporting a real Pino instance; asserts the logger level survives intofastify.log.Verification
test/**/*.test.jssuite unchanged (78/85 locally on Windows — the 5 failures are the Windows-onlyEBUSYfamily documented in fix: restore CI test execution and repair CJS/CLI regressions from dependency bumps #910)npm run lintcleanDepends on #910 — this branch contains it (the start.js path cannot even run without those interop fixes; rebase after that merges if needed).