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

[suggestion] Flush stderr after sending each log message #14298

Closed
1 task done
BobIsOnFire opened this issue Jul 13, 2023 · 3 comments · Fixed by #14310
Closed
1 task done

[suggestion] Flush stderr after sending each log message #14298

BobIsOnFire opened this issue Jul 13, 2023 · 3 comments · Fixed by #14310
Assignees
Milestone

Comments

@BobIsOnFire
Copy link
Contributor

BobIsOnFire commented Jul 13, 2023

What is your question?

Hi! As far as I can understand, Conan 2.0 doesn’t flush stderr regularly when writing log messages.

When a relatively long operation without any output gets executed, you don’t see what is actually being executed, since the corresponding helpful log message is buffered and not printed yet. On multiple occasions I was trying to understand why some totally harmless operation is executing for so long, when in fact Conan was downloading & unpacking a large package in source() method at that time :) I did self.output.flush() just before calling get() in the method as a workaround, which immediately improved readability… in that specific place.

I believe it is also bad to have unflushed escape sequences. If the stream flushes the buffer only when it is full (read: whenever it wants to), it can flush the start of the colored message, but not the end of it, where the color resets back.

Do you think this can be fixed? I would love to at least have a conf for that.

Thanks!

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@BobIsOnFire
Copy link
Contributor Author

BobIsOnFire commented Jul 14, 2023

I think I have also seen a problem with trace logs, when python tries to print a traceback from exception at the same time when Conan shows logs saying that something has broken, which completely messes up traceback. I am not sure this is related to flushing though..

@memsharded memsharded self-assigned this Jul 16, 2023
@memsharded memsharded added this to the 2.0.9 milestone Jul 16, 2023
@memsharded
Copy link
Member

Hi @BobIsOnFire

Thanks for reporting, I think it makes sense to flush automatically after every write, it seems it was done this way in 1.X. Submitting #14310 for next 2.0.9

@BobIsOnFire
Copy link
Contributor Author

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants