From f959b090f0fc86e72992980e6cb855671257300e Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Tue, 30 Apr 2024 00:01:33 +0800 Subject: [PATCH] Chore: [ALAS] Patch uiautomator2 loggers so they can be logged in Alas --- module/device/method/utils.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/module/device/method/utils.py b/module/device/method/utils.py index b4845a382..352d4361b 100644 --- a/module/device/method/utils.py +++ b/module/device/method/utils.py @@ -56,6 +56,22 @@ RETRY_DELAY = 3 # Patch uiautomator2 appdir u2.init.appdir = os.path.dirname(uiautomator2cache.__file__) +# Patch uiautomator2 logger +u2_logger = u2.logger +u2_logger.debug = logger.info +u2_logger.info = logger.info +u2_logger.warning = logger.warning +u2_logger.error = logger.error +u2_logger.critical = logger.critical + + +def setup_logger(*args, **kwargs): + return u2_logger + + +u2.setup_logger = setup_logger +u2.init.setup_logger = setup_logger + def is_port_using(port_num): """ if port is using by others, return True. else return False """