-
Notifications
You must be signed in to change notification settings - Fork 254
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
Logging to the progress bar #124
Comments
simple solution: pass in your own progressbar object |
I run into this all the time still, mostly with large data migration tasks. Has there been a status change for this? If not, would it make sense for progress = ProgressBar.create(format: "%t (%c/%C): |%w|")
Progress.each(data, progress: progress) do |x|
progress.log("whatever")
end |
sounds good, make a PR please :) |
I made a patch, but it doesn't seem promising, it still results in some uneven prints. 💩 Since the progress bar is unsynced from the parallel behavior, it's not surprising I was hoping to tie into the mutex on parallel with a custom progressbar output class, but progressbar initializes the custom outputter and you can't override it after creation. I'm not sure this would end up with any better results than just using
Here's the code anyway: bbugh@f31d219 |
thx for looking into it and providing some code for others to hack on :) |
This is super hacky, but you can access the progress bar instance with: ObjectSpace.each_object(ProgressBar::Base).first Calling |
Directly outputting to stdout or stderr (
puts
orwarn
) doesn’t play well with ruby-progressbar. Instead, it’s recommended to call#log
on theProgressBar
instance.Would is be possible to get access to the instance of
ProgressBar
instantiated with Parallel?The text was updated successfully, but these errors were encountered: