-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Feature Request: progress monitor #854
Comments
Hmm. A nice bar is really useful only interactively, so stdout, ansicolor and wincolor sinks. What it'd need is a way to intercept the line-writes, so that it can issue command codes to move the cursor as needed. Right now those are direct |
Nice Idea, but I think it is not very easy to achieve (esp. without breaking the existing API). A possible approach would be a new sink type (e.g. "progress_sink") that destructs when progress is complete: template<typename Container>
void spdlog::progress(const std::string &logger_name, const Container &container)
{
progress_sink the_sink(container.size()) /*total steps */);
for (auto& i : container)
{
the_sink.log_step(...)
} //progress_sink dies here. add newline or whatever in its destructor
}
I think it can done be in the constructing a formatter with custom eol. Each sink owns its own private formatter instance. |
If I find the time, I may still look into this. |
It would be neat to have a progress monitor integrated with spdlog. Something to be used like this:
or even
Ideally, it'd use terminal magic from the sink where available to show a pretty bar at the bottom with messages scrolling away above, or minimal output if the sink is a file.
Something like TQDM (which is actually quite fast).
The most basic implementation is so simple, most progress displays are probably home-built. Looking at the above, though, there are quite a few niceties that can't be justified when written for a single project. Loggerhead implements a progress bar using spdlog and might serve as a starting point.
The text was updated successfully, but these errors were encountered: