mirror of
https://github.com/isjerryxiao/pacroller.git
synced 2024-11-26 01:30:42 +08:00
NullHandler is causing problem
This commit is contained in:
parent
76b13e8e16
commit
ee86bb7648
1 changed files with 6 additions and 4 deletions
|
@ -131,7 +131,7 @@ def do_system_upgrade(debug=False, interactive=False) -> checkReport:
|
|||
else:
|
||||
raise MaxRetryReached(f'sync failed {NETWORK_RETRY} times')
|
||||
|
||||
stdout_handler = logging.NullHandler
|
||||
stdout_handler = None
|
||||
if SAVE_STDOUT:
|
||||
try:
|
||||
LOG_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
@ -142,7 +142,8 @@ def do_system_upgrade(debug=False, interactive=False) -> checkReport:
|
|||
stdout_handler.setLevel(logging.DEBUG)
|
||||
except Exception:
|
||||
logging.exception(f"unable to save stdout to {LOG_DIR}")
|
||||
stdout_handler = logging.NullHandler
|
||||
stdout_handler = None
|
||||
if stdout_handler:
|
||||
logger.addHandler(stdout_handler)
|
||||
|
||||
for _ in range(NETWORK_RETRY):
|
||||
|
@ -160,6 +161,7 @@ def do_system_upgrade(debug=False, interactive=False) -> checkReport:
|
|||
else:
|
||||
raise MaxRetryReached(f'upgrade failed {NETWORK_RETRY} times')
|
||||
|
||||
if stdout_handler:
|
||||
logger.removeHandler(stdout_handler)
|
||||
|
||||
with open(PACMAN_LOG, 'r') as pacman_log:
|
||||
|
|
Loading…
Reference in a new issue