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

Allow to print (log) messages above the progress bar #27

Closed
bomgar opened this issue Sep 8, 2017 · 7 comments
Closed

Allow to print (log) messages above the progress bar #27

bomgar opened this issue Sep 8, 2017 · 7 comments

Comments

@bomgar
Copy link

bomgar commented Sep 8, 2017

Currently messages with println!() are overwritten by the next progress bar tick. It would be awesome to have something like pb.log("hello") and have hello printed with the next tick above the bars.

@mitsuhiko
Copy link
Collaborator

You can use newlines in the template. There are two values that can be set: prefix and message and both can be set. So you can set the "line above" to the prefix and render it.

@bomgar
Copy link
Author

bomgar commented Sep 29, 2017

Does this work with multi bars?

@mitsuhiko
Copy link
Collaborator

Yes.

@bomgar
Copy link
Author

bomgar commented Sep 29, 2017

I have 4 worker threads with steady_tick enabled. Every time they finish a task I want to log that. Changing the prefix just multiplies the bars for me. The result looks really strange. Surprisingly the tick_chars further update still get updated. It also doesn't really write above all bars. Just above the one the thread is updating which is not what i want.

I don't think this is a clean way to write log messages.

@mitsuhiko
Copy link
Collaborator

You can use different styles for different bars. So the first bar can be used to write out messages.

@bomgar
Copy link
Author

bomgar commented Sep 29, 2017

Ok i guess I could try that. But doesn't that mean all threads must have access to the first bar or send messages to the thread responsible for the first bar? This seems like my code will become a lot less readable. This isn't a clean API. It feels like a really dirty workaround.

@mitsuhiko
Copy link
Collaborator

I’m gladly accepting patches but I am not sure how this could be done nicer currently.

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

2 participants