Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PFX-350]: Upgrade to Fastify v4 #727

Merged
merged 26 commits into from
Aug 19, 2024
Merged

[PFX-350]: Upgrade to Fastify v4 #727

merged 26 commits into from
Aug 19, 2024

Conversation

bbetts-godaddy
Copy link
Contributor

Summary

This PR includes updates to the BYO logger to be compatible with the pino logger used by Fastify.

Changelog

  • Upgrade to Fastify v4

Test Plan

  • Creating an app with the fastify plugin locally builds and runs as expected.

Tests Passing

Screen Shot 2023-01-23 at 3 09 56 PM

Screen Shot 2023-01-23 at 3 10 27 PM

Screen Shot 2023-01-23 at 3 11 02 PM

@bbetts-godaddy bbetts-godaddy requested review from kinetifex and a team as code owners April 11, 2024 01:39
@bbetts-godaddy bbetts-godaddy added the version 7 Change targeted for version 7 label Apr 11, 2024
Copy link

package-lock.json changes

Summary

Status Count
ADDED 6
UPDATED 17
REMOVED 8
Click to toggle table visibility
Name Status Previous Current
@fastify/accept-negotiator ADDED - 1.1.0
@fastify/ajv-compiler UPDATED 1.1.0 3.5.0
@fastify/deepmerge REMOVED 1.3.0 -
@fastify/error UPDATED 2.0.0 3.4.1
@fastify/middie ADDED - 8.3.0
@fastify/send ADDED - 2.1.0
@fastify/static UPDATED 5.0.2 7.0.2
@fastify/swagger-ui ADDED - 3.0.0
@fastify/swagger UPDATED 6.1.0 8.14.0
@lukeed/ms ADDED - 2.0.2
avvio UPDATED 7.2.5 8.3.0
encoding-negotiator REMOVED 2.0.1 -
fast-json-stringify UPDATED 2.7.13 5.13.0
fastify-plugin REMOVED 3.0.1 -
fastify UPDATED 3.29.5 4.26.2
find-my-way UPDATED 4.5.1 8.1.0
flatstr REMOVED 1.0.12 -
json-schema-resolver UPDATED 1.3.0 2.0.0
light-my-request UPDATED 4.9.0 5.12.0
middie REMOVED 5.4.0 -
openapi-types UPDATED 10.0.0 12.1.3
path-scurry UPDATED 1.10.1 1.10.2
pino-std-serializers UPDATED 3.2.0 6.2.2
pino UPDATED 6.14.0 8.19.0
process-warning UPDATED 1.0.0 3.0.0
ret ADDED - 0.2.2
semver-store REMOVED 0.3.0 -
set-cookie-parser UPDATED 2.4.8 2.6.0
sonic-boom UPDATED 1.4.1 3.8.0
string-similarity REMOVED 4.0.4 -
tiny-lru REMOVED 8.0.2 -

const fastifyLogger = logger;
['fatal', 'trace', 'debug', 'error', 'warn', 'info'].map(level => {
if (!logger[level]) {
fastifyLogger[level] = logLevels[level];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will want to fallback to the logger's methods, not the console's.

debug, error, info, and warn are guaranteed (verify code) to be on the logger.

const fallbackMap = {
  fatal: 'error',
  trace: 'debug'
}
Suggested change
fastifyLogger[level] = logLevels[level];
fastifyLogger[level] = logger[fallbackMap[level]];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Just made that update.

@bbetts-godaddy bbetts-godaddy merged commit f4f2c8f into v7 Aug 19, 2024
1 check passed
@bbetts-godaddy bbetts-godaddy deleted the pfx-530-new branch August 19, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
version 7 Change targeted for version 7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants