-
Notifications
You must be signed in to change notification settings - Fork 69
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
fix: lazy init default logger #111
Conversation
The default logger will try to query background et al on startup, which might conflict with other libs trying to query it too. It's easily reproducible with some of our tools that use the log package, e.g., VHS: ```sh faketty vhs --help ``` It slows down the program quite a bit, and print some ansi escape sequences as well. This patch changes it so it only inits the default logger when/if the default logger is used. Per my testing, it seems to fix the original issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!!! ❤️
PS: this is not a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @caarlos0!
refs charmbracelet/log#111 Signed-off-by: Carlos Alexandro Becker <[email protected]>
refs charmbracelet/log#111 Signed-off-by: Carlos Alexandro Becker <[email protected]>
refs charmbracelet/log#111 Signed-off-by: Carlos Alexandro Becker <[email protected]>
refs charmbracelet/log#111 Signed-off-by: Carlos Alexandro Becker <[email protected]>
The default logger will try to query background et al on startup, which might conflict with other libs trying to query it too.
It's easily reproducible with some of our tools that use the log package, e.g., VHS:
It slows down the program quite a bit, and print some ansi escape sequences as well.
This patch changes it so it only inits the default logger when/if the default logger is used.
Per my testing, it seems to fix the original issue.