Encapsulate the Progress Bar
Looking for something easier? (try these )
Wrap up the code for the Progress Bar, reducing the effort for the callers and
unify the logging of progress events.
Part 1: Review Logging Levels
There are currently 5 debug logging levels, which aren't used consistently.
The new guideline is:
Level 1-3: General debug info (at the programmer's discretion)
Level 4: Progress bar, trace info, e.g. "Entering function()"
Level 5: Data read/written/transferred, or other private info
There are about 65 calls to mutt_debug()
which need reviewing.
This shouldn't take too long.
For each message decide whether it should be:
Level 3: General
Level 4: Progress
Level 5: Data
Part 2: Create a LL_PROGRESS Log Level
Create a new debugging level LL_PROGRESS
and change the progress bar to use it.
You'll need to alter the logging code, too.
Progress messages should always be displayed on screen, but only be written
to file if $debug_level >= 4
.
Now run neomutt -d3
with some large folders, etc, and find any other progess
messages that should have their level altered.
Try some large searches, too.
Part 3: Encapsulate the Progress Bar
Change the code to dynamically create()
and destroy()
the Progress object.
This will allow the progress bar to signal when it's done.
Currently, the code is littered with calls to mutt_window_clearline()
many of
which only exist to clear away the last progress message.
(This isn't required for this issue)
The update frequency for the progress bar is controlled by:
net_inc
read_inc
time_inc
write_inc
It would make sense for this to be handled by the progess bar itself.