Chore: [ALAS] Patch uiautomator2 loggers so they can be logged in Alas

This commit is contained in:
LmeSzinc 2024-04-30 00:01:33 +08:00
parent 24fbff17ef
commit f959b090f0

View File

@ -56,6 +56,22 @@ RETRY_DELAY = 3
# Patch uiautomator2 appdir # Patch uiautomator2 appdir
u2.init.appdir = os.path.dirname(uiautomator2cache.__file__) 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): def is_port_using(port_num):
""" if port is using by others, return True. else return False """ """ if port is using by others, return True. else return False """