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

Improve log legibility #470

Merged
merged 3 commits into from
Dec 12, 2024
Merged

Improve log legibility #470

merged 3 commits into from
Dec 12, 2024

Conversation

webfiltered
Copy link
Contributor

@webfiltered webfiltered commented Dec 12, 2024

Strips all escape codes from wrapped-process output logs.

From this:

[2024-12-12 23:55:59.116] [info]  �[?25l�[37m�[H⠸ �[m�[2mResolving dependencies...                                                     �[K�[?25h�[1;134H
[2024-12-12 23:55:59.135] [info]  �[?25l�[22m�[1;80H�[?25h
[2024-12-12 23:55:59.309] [info]  �[?25l�[37m�[H⠸ �[m�[2maiohappyeyeballs==2.4.3                                                       �[K�[?25h�[1;136H
[2024-12-12 23:55:59.328] [info]  �[?25l�[22m�[37m�[H⠼ �[m�[2maiohappyeyeballs==2.4.3                                                       �[K�[?25h�[1;136H

To this:

[2024-12-12 23:55:59.116] [info]  ⠸ Resolving dependencies...                                                     
[2024-12-12 23:55:59.135] [info]  
[2024-12-12 23:55:59.309] [info]  ⠸ aiohappyeyeballs==2.4.3                                                       
[2024-12-12 23:55:59.328] [info]  ⠼ aiohappyeyeballs==2.4.3                                                       

Strips all escape codes from terminal output logs
@robinjhuang
Copy link
Member

Much needed change, thank you! We could add this to the transforms function of electron-log. But this is fine to merge as is as well!
https://github.com/megahertz/electron-log/blob/master/docs/extend.md#transforms

@webfiltered
Copy link
Contributor Author

I hadn't actually had a chance to look at logging infra - thank you. Would much prefer this done through API.

Framework is not appropriate for these two call sites - log is shared with entire app, has no filtering available, and requires type kludges.
@webfiltered
Copy link
Contributor Author

Tried to make it work - electron-log is very lean - but doesn't really suit 2/3 of the call sites. Fixed the code there in other ways.

Location of the regex can be moved from utils, if there's a better spot.

@huchenlei huchenlei merged commit 15560fb into main Dec 12, 2024
7 checks passed
@huchenlei huchenlei deleted the clean-logs branch December 12, 2024 20:59
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