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

Add an option to log to stdout #1473

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Fat-Zer
Copy link

@Fat-Zer Fat-Zer commented Dec 12, 2024

@DivingDuck
Copy link
Collaborator

@rockstorm101,
I took a look on it and did a quick test locally. I'm ok with the this change. You can approve as soon you find some spare time.
The not successful checks should be corrected with the workflow adjustments of #1465

@Fat-Zer,
Sorry for the delay. Thank you very much for this PR

Reminder to myself:
I need to update the translation template and language files when the PR is approved. I will add this part to PR#1465

Best regards, DD

Copy link
Collaborator

@rockstorm101 rockstorm101 left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this PR, I'm generally happy with it. Just a couple of comments. Sorry it took me so long to review.

@@ -81,35 +81,38 @@ def format_length(mm, fractional=2):
return '%%.%df' % fractional % units + suffix

class ConsoleOutputHandler:
"""Handle console output. All messages go through the logging submodule. We setup a logging handler to get logged messages and write them to both stdout (unless a log file path is specified, in which case we add another logging handler to write to this file) and the log panel.
We also redirect stdout and stderr to ourself to catch print messages and al."""
"""Handle console output. All messages go through the logging submodule. We setup a logging handler to get logged
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for wrapping this test. Could we please wrap at 78 characters though? Something like this:

 class ConsoleOutputHandler:
-    """Handle console output. All messages go through the logging submodule. We setup a logging handler to get logged
-    messages and write them to both stdout (unless a log file path is specified, in which case we add another logging
-    handler to write to this file) and the log panel. We also redirect stdout and stderr to ourselves to catch print
-    messages and al."""
+    """Handle console output. All messages go through the logging
+    submodule. We setup a logging handler to get logged messages and write
+    them to both stdout (unless a log file path is specified, in which case we
+    add another logging handler to write to this file) and the log panel. We
+    also redirect stdout and stderr to ourselves to catch print messages and
+    all."""
 

"""Handle console output. All messages go through the logging submodule. We setup a logging handler to get logged
messages and write them to both stdout (unless a log file path is specified, in which case we add another logging
handler to write to this file) and the log panel. We also redirect stdout and stderr to ourselves to catch print
messages and al."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

"and al" -> "et al"

self.stdout = sys.stdout
self.stderr = sys.stderr
sys.stdout = self
sys.stderr = self
self.print_on_stdout = not log_path
if log_path:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was worried about removing this check, but in my tests I could not make it fail due to this removal. So I'm happy with it. But if you could double check I would appreciate it.

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