-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
- I have marked all applicable categories:
- exception-raising bug
- visual output bug
- I have visited the source website, and in particular
read the known issues - I have searched through the issue tracker for duplicates
- I have mentioned version numbers, operating system and
environment, where applicable:- Python 3.11.8
- linux
- tqdm 4.66.4
When using a logging.Filter
, it seems to be not working when inside the logging_redirect_tqdm context manager. Here is an example:
import logging
from tqdm.contrib.logging import logging_redirect_tqdm
class Filter(logging.Filter):
def filter(self, record):
record.msg = f"{record.msg} -- filter"
return True
filter = Filter()
handler = logging.StreamHandler()
handler.addFilter(filter)
logging.basicConfig(handlers=[handler])
logger = logging.getLogger("main")
logger.error("outside redirect")
with logging_redirect_tqdm():
logger.error("inside redirect")
Expected output
ERROR:main:outside redirect -- filter
ERROR:main:inside redirect -- filter
Actual output
ERROR:main:outside redirect -- filter
ERROR:main:inside redirect
It looks like they just ought to be copied over from the original handler. If you like I can prepare a pull request.
Metadata
Metadata
Assignees
Labels
No labels