python-coloredlogs
python-coloredlogs copied to clipboard
output not being redirected by contextlib
When testing log outputs I sometimes use io and contextlib.redirect_stderr in the following way:
import io
from contextlib import redirect_stderr
log_output = io.StringIO()
with redirect_stderr(log_output):
cause_some_horrible_error()
Up until 14.1, this would work as expected. That is, running log_output.getvalue() would return the output of the logged error. However, now log_output.getvalue() just returns an empty string. This seems broken in 14.1, 14.2, 14.3 and 15.0.