Skip to content

Use tqdm logging_redirect_tqdm to not break progress bars #294

@abbbi

Description

@abbbi

Some logging messages during backup lead to messing up the progress bar view, especially if multiple disks are
backed up and finish at different times.

New TQDM versions support a safe logging mechanism by using the logging_redirect_tqdm method:

from tqdm.contrib.logging import logging_redirect_tqdm
    with logging_redirect_tqdm():
        log.info("Checksum for file: [%s]:[%s]", targetFile, checksum)

this works pretty well, the Progress bars are then staying at the bottom of the terminal and new logging messages appear above.

Unfortunately, TQDM versions on older distributions do not yet support this feature (for example epel-release on rhel8, debian bullseye.. )

First version with feature:

https://github.com/tqdm/tqdm/releases/tag/v4.62.1

so to keep support for these old distributions, a wrapper needs to be setup

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions