Skip to content

Commit

Permalink
Fine tune some logging (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
theyosh committed Mar 8, 2024
1 parent 8d0c681 commit 1aa4312
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions hardware/relay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ def __get_hardware_value(self):
data = func_timeout(self._UPDATE_TIME_OUT, self._get_hardware_value)

except FunctionTimedOut:
raise terrariumRelayUpdateException(f"{error_message}: Timed out after {self._UPDATE_TIME_OUT} seconds.")
raise terrariumRelayUpdateException(f"{error_message}: Timed out after {self._UPDATE_TIME_OUT} seconds")
except Exception as ex:
raise terrariumRelayUpdateException(f"{error_message}: {ex}.")
raise terrariumRelayUpdateException(f"{error_message}: {ex}")

if data is None:
raise terrariumRelayUpdateException(f"{error_message}: no data.")
raise terrariumRelayUpdateException(f"{error_message}: no data")

return data

Expand Down
6 changes: 3 additions & 3 deletions hardware/sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,14 @@ def get_data(self):
data = func_timeout(self._UPDATE_TIME_OUT, self._get_data)

except FunctionTimedOut:
raise terrariumSensorUpdateException(f"{error_message}: Timed out after {self._UPDATE_TIME_OUT} seconds.")
raise terrariumSensorUpdateException(f"{error_message}: Timed out after {self._UPDATE_TIME_OUT} seconds")
except Exception as ex:
raise terrariumSensorUpdateException(f"{error_message}: {ex}.")
raise terrariumSensorUpdateException(f"{error_message}: {ex}")
finally:
self.__power_management(False)

if data is None:
raise terrariumSensorUpdateException(f"{error_message}: no data.")
raise terrariumSensorUpdateException(f"{error_message}: no data")

return data

Expand Down
4 changes: 2 additions & 2 deletions terrariumArea.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __repr__(self):
Returns:
string: Area with area type
"""
return f'{terrariumArea.__TYPES[self.type]["name"]} named {self.name}'
return f'{terrariumArea.__TYPES[self.type]["name"]} named \'{self.name}\''

@property
def _powered(self):
Expand Down Expand Up @@ -877,7 +877,7 @@ def update(self, read_only=False):
self.state["last_update"] = int(datetime.datetime.now().timestamp())

logger.info(
f"Updated area {self} in {self.mode} mode at enclosure {self.enclosure.name} in {time.time()-start:.2f} seconds."
f"Updated area {self} in '{self.mode}' mode at enclosure {self.enclosure.name} in {time.time()-start:.2f} seconds."
)
return self.state

Expand Down

0 comments on commit 1aa4312

Please sign in to comment.