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

Stop redraw when there is other logging #145

Open
hootpy opened this issue Jul 11, 2023 · 6 comments
Open

Stop redraw when there is other logging #145

hootpy opened this issue Jul 11, 2023 · 6 comments

Comments

@hootpy
Copy link

hootpy commented Jul 11, 2023

In the code Im running there is an exception so I log the messages. the problem is that it will break the bar and make it redraw. How to make the bar stick at the bottom of the terminal? Thanks in advanced!

@Kaveh-ap
Copy link

I'm facing this issue too!

@gregormaclaine
Copy link

At the moment, the SingleBar does not allow additional logging messages during the progressbar's display. This is however available if you use the MultiBar which has a .log() function which I believe is what you are looking for.

@Kaveh-ap
Copy link

@gregormaclaine Thanks man, it works like a charm!

@andreiled
Copy link

@gregormaclaine, thank you for the above suggestion!
For the most part, it worked for me as well.

However, I did notice a weird behavior: the very last message I log using MultiBar.log is lost if I then call MultiBar.stop right away.
After some experimentation, I noticed that adding a short sleep right before I call MultiBar.stop helps that last logged message to appear, so this feels like some concurrency issue with how messages are flushed or something...

@jcapcik
Copy link

jcapcik commented Dec 18, 2023

@andreiled I ran into this as well. It's because it buffers the logs, and only outputs them when the MultiBar.update() is triggered, which is based on the throttleRate/FPS. I think this could be fixed by adding outputting of the log buffer in the stop() routine here as that is meant to show final progress, but it seems simply forcing an update() call on the MultiBar before the stop() seems to work. update() is meant as an internal function (not a part of the API), but it's working for me.

@andreiled
Copy link

@jcapcik, thank you for the suggestion!
I will try it out.

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

No branches or pull requests

5 participants