move enable/disable python logging to functions