Skip to content

Commit

Permalink
Log info for state observer (#542)
Browse files Browse the repository at this point in the history
* Log info for state observer

* don't duplicate message
  • Loading branch information
marcin-usielski authored Jul 18, 2024
1 parent ba58b64 commit 617b113
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions moler/device/textualdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,12 @@ def _prompts_observer_callback(self, event):
occurrence = event.get_last_occurrence()
state = occurrence["state"]
line = occurrence["line"]
self._log(level=logging.DEBUG, msg=f"Callback for state {state} for line >>{line}<<")
self._set_state(state)
msg = f"Callback for state {state} for line >>{line}<<"
if self.current_state != state:
self._log(level=logging.INFO, msg=msg)
self._set_state(state)
else:
self._log(level=logging.DEBUG, msg=msg)
if self._check_all_prompts_on_line:
if len(occurrence["list_matched"]) > 1:
prompts = [{item["state"]: item["prompt_regex"]} for item in
Expand Down

0 comments on commit 617b113

Please sign in to comment.