How to redirect stdout and stderr to logger in Python How to redirect stdout and stderr to logger in Python python-3.x python-3.x