From 41dd8b9c261d9f0cc1d6e00f6f71311d218f040d Mon Sep 17 00:00:00 2001 From: Marcin Usielski Date: Wed, 13 Nov 2024 13:06:42 +0000 Subject: [PATCH] info --- moler/config/loggers.py | 2 +- moler/device/proxy_pc2.py | 14 ++++++++------ moler/device/unixremote2.py | 13 +++++++------ setup.py | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/moler/config/loggers.py b/moler/config/loggers.py index b97676eca..413556968 100644 --- a/moler/config/loggers.py +++ b/moler/config/loggers.py @@ -84,7 +84,7 @@ %% %%% %%% %% %%% %% %%% %%%%%%%%% %%% %%%%%%% %% %%%%% %% %%% %% %%% %%% %%% %%% %% %%% %% %%%%%%%%%%% %%%%%%%%% %%%%%%%%%% %%% %%% - Prompt detecting v1. + Prompt detecting v2. """ diff --git a/moler/device/proxy_pc2.py b/moler/device/proxy_pc2.py index 9629ad777..fbb5c7266 100644 --- a/moler/device/proxy_pc2.py +++ b/moler/device/proxy_pc2.py @@ -247,6 +247,7 @@ def on_connection_made(self, connection): self._prompt_detected = False # prompt not defined in SM self._set_state(PROXY_PC) self._detect_after_open_prompt(self._set_after_open_prompt) + self._detect_prompt_get_cmd() def on_connection_lost(self, connection): """ @@ -257,7 +258,7 @@ def on_connection_lost(self, connection): self._set_state(NOT_CONNECTED) def _detect_after_open_prompt(self, set_callback): - self.logger.debug("Command to detect prompt will be sent.") + self.logger.info(f"Command to detect prompt will be sent. Callback: {set_callback}") self._prompt_detected = False self._after_open_prompt_detector = Wait4( detect_patterns=[rf'^(.+){self._detecting_prompt_cmd}'], @@ -277,20 +278,21 @@ def _set_after_open_prompt(self, event): occurrence = event.get_last_occurrence() prompt = occurrence['groups'][0].rstrip() state = self._get_current_state() - self.logger.debug(f"ProxyPc2 for state '{state}' new prompt '{prompt}' reverse_state_prompts_dict: '{self._reverse_state_prompts_dict}'.") + self.logger.info(f"ProxyPc2 for state '{state}' new prompt '{prompt}' reverse_state_prompts_dict: '{self._reverse_state_prompts_dict}'.") with self._state_prompts_lock: old_prompt = self._state_prompts.get(state, None) prompt = re.escape(prompt) self._state_prompts[state] = prompt if old_prompt is not None and prompt != old_prompt: self.logger.info(f"Different prompt candidates: '{old_prompt}' -> '{prompt}' for state {state}.") - self.logger.debug(f"New prompts: {self._state_prompts}") + self.logger.info(f"New prompts: {self._state_prompts}") self._prepare_reverse_state_prompts_dict() - self.logger.debug(f"After prepare_reverse_state_prompts_dict: {self._reverse_state_prompts_dict}") + self.logger.info(f"After prepare_reverse_state_prompts_dict: {self._reverse_state_prompts_dict}") if self._prompts_event is not None: - self.logger.debug("prompts event is not none") + self.logger.info("prompts event is not none") self._prompts_event.change_prompts(prompts=self._reverse_state_prompts_dict) self._prompt_detected = True + self.logger.info("Prompt detected") def _prepare_state_prompts(self): """ @@ -452,7 +454,7 @@ def get_cmd(self, cmd_name, cmd_params=None, check_state=True, for_state=None): for_state=for_state) def _detect_prompt_get_cmd(self): - self.logger.debug("get_cmd was called but prompt has not been detected yet.") + self.logger.info("get_cmd was called but prompt has not been detected yet.") if self._after_open_prompt_detector is None or not self._after_open_prompt_detector.running(): self._detect_after_open_prompt(self._set_after_open_prompt) self._after_open_prompt_detector.await_done(timeout=self._prompt_detector_timeout) diff --git a/moler/device/unixremote2.py b/moler/device/unixremote2.py index f3768406f..3f1937c05 100644 --- a/moler/device/unixremote2.py +++ b/moler/device/unixremote2.py @@ -391,12 +391,12 @@ def _set_after_open_prompt(self, event): occurrence = event.get_last_occurrence() prompt = occurrence['groups'][0].rstrip() state = self._get_current_state() - self.logger.debug(f"UnixRemote2 for state '{state}' new prompt '{prompt}' reverse_state_prompts_dict: '{self._reverse_state_prompts_dict}'.") + self.logger.info(f"UnixRemote2 for state '{state}' new prompt '{prompt}' reverse_state_prompts_dict: '{self._reverse_state_prompts_dict}'.") with self._state_prompts_lock: old_prompt = self._state_prompts.get(state, None) prompt = re.escape(prompt) self._state_prompts[state] = prompt - self.logger.debug(f"state_prompts after change: {self._state_prompts}") + self.logger.info(f"state_prompts after change: {self._state_prompts}") self._prepare_reverse_state_prompts_dict() if old_prompt is not None and prompt != old_prompt: self.logger.info(f"Different prompt candidates: '{old_prompt}' -> '{prompt}' for state {state}.") @@ -404,14 +404,15 @@ def _set_after_open_prompt(self, event): self._update_depending_on_ux_prompt() elif state == PROXY_PC: self._update_depending_on_proxy_prompt() - self.logger.debug(f"UnixRemote2. updated _reverse_state_prompts_dict: {self._reverse_state_prompts_dict}") + self.logger.info(f"UnixRemote2. updated _reverse_state_prompts_dict: {self._reverse_state_prompts_dict}") if self._prompts_event is not None: - self.logger.debug("prompts event is not none") + self.logger.info("prompts event is not none") self._prompts_event.change_prompts( prompts=self._reverse_state_prompts_dict) - self.logger.debug(f"New prompts: {self._state_prompts}") - self.logger.debug(f"After prepare_reverse_state_prompts_dict: {self._reverse_state_prompts_dict}") + self.logger.info(f"New prompts: {self._state_prompts}") + self.logger.info(f"After prepare_reverse_state_prompts_dict: {self._reverse_state_prompts_dict}") self._prompt_detected = True + self.logger.info("Prompt detected") @mark_to_call_base_class_method_with_same_name def _prepare_state_prompts_with_proxy_pc(self): diff --git a/setup.py b/setup.py index bbb86c405..4f98ee3e2 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name='moler', - version='3.12.150', + version='3.12.152', description='Moler is a library for working with terminals, mainly for automated tests', # Required long_description=long_description, long_description_content_type='text/markdown',