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

feat(apps/price_pusher)!: switch to structured logger via pino #1714

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

ali-bahjati
Copy link
Collaborator

This change switches from console to pino for logging that is a structured logger and allows us to have json formatted loggers. In adition to just that change, pino does an amazing job at logging the errors by including all their data + the stacktrace.

This change does minimal change to the log level and the console.log is changed to info or debug level based on my judgement.

This change is marked as breaking because it breaks any reliability/ops based on the logs.

The attached images show the new log outputs in both pretty and json formats, as well as error logs.

image
image

Copy link

vercel bot commented Jun 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 20, 2024 9:00am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
xc-admin-frontend ⬜️ Ignored (Inspect) Visit Preview Jun 20, 2024 9:00am

Copy link
Collaborator

@cprussin cprussin left a comment

Choose a reason for hiding this comment

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

Pino is awesome! Great call moving this over.

Mostly LGTM but I'd definitely recommend removing pino-pretty from the production dependencies.

I'm not familiar with the interfaces enough here but is there an option to pass a logger instance to any entrypoint that a library would consume? If not, I strongly recommend adding one -- it's very common for apps to have their own pino (or bunyan) instances and to want to use a child logger for a library.

apps/price_pusher/src/logger.ts Outdated Show resolved Hide resolved
apps/price_pusher/src/logger.ts Outdated Show resolved Hide resolved
apps/price_pusher/src/evm/command.ts Outdated Show resolved Hide resolved
This change switches from `console` to `pino` for logging that is a
structured logger and allows us to have json formatted loggers. In
adition to just that change, pino does an amazing job at logging the
errors by including all their data + the stacktrace.

This change does minimal change to the log level and the `console.log`
is changed to info or debug level based on my judgement.

This change is marked as breaking because it breaks any reliability/ops
based on the logs.
@ali-bahjati ali-bahjati merged commit 2faaa43 into main Jun 20, 2024
6 checks passed
@ali-bahjati ali-bahjati deleted the price_pusher/use-pino branch June 20, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants