Comments (7)
I feel the title of this issue is a bit misleading. The log
method is only part of the TTY::ProgressBar
API and doesn't mention any support for multi-level progress bar logging. I think it would be better to rename it as a feature request?
I haven't thought about how the log
method could work for TTY::Progress::Multi
. It seems that one alternative approach to making this work could be to make the individual progress bar log
method aware of multibar context. Since the current bar knows its position within the multi progressbar, you have a reliable way to print above all the bars the same way move_to_row
does it. Then the log
implementation on the Multi
would mean delegating logging via all progress bars or picking an individual bar. This could work? Please submit PR if you have anything working as it's much easier for me to see where potential issues are.
from tty-progressbar.
If it's easier, TTY::ProgressBar::Multi
could have a log
method rather than each individual bar logging, which would be fine too.
from tty-progressbar.
Sorry, this seems to be an issue with using Parallel more than this gem. It looks like Parallel would have to integrate with this for it to be successful.
from tty-progressbar.
Hi Brian 👋
Thanks for using tty-progressbar
.
Currently, the TTY::ProgressBar::Multi
API doesn't have log
support. I'd consider adding it if you have time to send a pull request. The behaviour should be similar to TTY::ProgressBar#log
in so far as the logging would be printed above all registered bars.
Not sure if this helps but you can update an individual bar display with custom tokens using the advance method like so:
Parallel.each(examples) do
bars[Parallel.worker_number].advance(X, name: "Something")
end
from tty-progressbar.
Hey there, I'm having a crack at this again because I have another case where I need multiple processes and need to log from them. I've tried lots of different things to add log
to ProgressBar::Multi
and they all seem to have an edge case. I tried using TTY::Cursor.up
and TTY::Cursor.down
to reposition, along with flushing the output, NEXTLINE
, etc. The best I can come up with is overwriting the top line.
I think one of the root problems is that since the current row
is determined in the bar when it prints, it seems like there's not a reliable way to use up
and down
from the multi bar. Another is that move_to_row
overrides anything that might be going on in the multi progress bar if writing via a bar.
Do you have any hints for how I could make this work?
from tty-progressbar.
I fixed the title, thanks for catching that.
I tried for a while to log via top_bar
and that was the closest to success I had, but I couldn't get it to log a line, and then go to the next line, and then start drawing the bars again. It would draw over the top line instead.
I will make a draft PR tonight and go from there. Thanks!
from tty-progressbar.
I created #52 that has WIP code for this. Two examples of getting close but not quite.
There's a multi_test.rb
in the root folder that you can run to quickly test, if you want. (I will of course delete this and write real tests once it's figured out)
Thanks for taking a look.
from tty-progressbar.
Related Issues (20)
- TTY::ProgressBar::Multi finishes too early HOT 2
- ProgressBar#iterate vs LazyEnumerator HOT 8
- Be aware of Unicode width HOT 3
- Broken multi progress bar HOT 3
- Progress width is wrongly calculated when color escape codes are used HOT 1
- `log` feature ala ruby-progressbar HOT 2
- Multi progress bar does not update drawing current / total values properly HOT 4
- Performance issues? HOT 17
- When using `hide_cursor`, it remains hidden on premature exit HOT 3
- Error if "complete" is Unicode HOT 9
- Option `no_width` should be documented in README.md HOT 9
- Time left indication HOT 2
- strings-ansi gem version conflict with other latest tty gems HOT 4
- [Feature]add alignment column before the bar show HOT 2
- ETA on a new release? HOT 3
- NaN FloatDomainError when using the :eta marker in v0.18.0 HOT 6
- Indeterminate MultiBars raise `undefined method `+' for nil:NilClass` HOT 3
- Add support for centered, overlay text
- Disable auto-finish HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tty-progressbar.