mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 08:38:20 +08:00
Opt: Remove log output to stdout when using electron
Try to avoid #2051
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import argparse
|
||||
import os
|
||||
import queue
|
||||
import threading
|
||||
@@ -119,8 +120,20 @@ class ProcessManager:
|
||||
def run_process(
|
||||
config_name, func: str, q: queue.Queue, e: threading.Event = None
|
||||
) -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--electron", action="store_true", help="Runs by electron client."
|
||||
)
|
||||
args, _ = parser.parse_known_args()
|
||||
State.electron = args.electron
|
||||
|
||||
# Setup logger
|
||||
set_file_logger(name=config_name)
|
||||
if State.electron:
|
||||
# https://github.com/LmeSzinc/AzurLaneAutoScript/issues/2051
|
||||
logger.info("Electron detected, remove log output to stdout")
|
||||
from module.logger import console_hdlr
|
||||
logger.removeHandler(console_hdlr)
|
||||
set_func_logger(func=q.put)
|
||||
|
||||
from module.config.config import AzurLaneConfig
|
||||
|
||||
Reference in New Issue
Block a user