TLDR
if a module uses
log.error("something happened")
we would like to see these logs, but as warnings, so that the net effect for us would be the same as if that module had used
log.warning("something happened")
More details
We use the aiokafka module which logs errors when the connection with confluent.cloud has trouble. However these are transient problems and after a while connection is re-established, so we would have preferred these logs to be warning instead of error, yet we don't want to lose those logs.
Is there a way to modify these log records "on the fly", to change their log level? I know I could
logger = logging.getLogger("aiokafka")
logger.setLevel(logging.CRITICAL)
but then all logs would get lost.
logging.getLogger("aiokafka").error = logging.getLogger("aiokafka").warning