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

Replace Winston Logger with Pino #506

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

AbdurrehmanSubhani
Copy link
Contributor

@AbdurrehmanSubhani AbdurrehmanSubhani commented Nov 11, 2024

This PR replaces the current logger (Winston) with (Pino).

The main reason for changing the underlying logger is Winston's issues handling transports alongside process.exit() usage, here's a link to the issue:
winstonjs/winston#228

We use process.exit() in a lot of places throughout the sdk hence using Winston for reliable file log dumping was becoming a problem.
Pino supports process.exit with their transport api making it a better choice for maintain log dump file.

** The error in the image was for testing purposes, the chat code works fine as expected

image

Copy link

vercel bot commented Nov 11, 2024

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

Name Status Preview Comments Updated (UTC)
chat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 0:22am
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 0:22am

['uncaughtException', 'unhandledRejection'].forEach(event =>
process.on(event, (err, err2) => {
console.error('cli uncaught exception', err, err2);
console.log("A complete log of this run can be found in: \n", logger.getLogFilePath());
Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea

Copy link
Contributor

@avaer avaer left a comment

Choose a reason for hiding this comment

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

It looks good, but does that mean we can remove the winston install to reduce package bloat?

@AbdurrehmanSubhani
Copy link
Contributor Author

It looks good, but does that mean we can remove the winston install to reduce package bloat?

Yeah we should, particularly because winston does not work with transport log with process.exit(), better to remove it entirely.

Removing it in the next commit

@AbdurrehmanSubhani AbdurrehmanSubhani changed the title Add error log path to console Replace Winston Logger with Pino Nov 20, 2024
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.

2 participants