Skip to content

Commit

Permalink
Improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Clon1998 committed Jul 3, 2024
1 parent 9968ffb commit 3b3b3df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mobileraker/client/mobileraker_fcm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def push(self, request: FcmRequestDto,) -> Optional[requests.Response]:
requests.exceptions.RequestException: If there was an error while communicating with the mobileraker server.
"""
jsons = request.toJSON()
self.logger.info("Submitting %i notifications to mobileraker server", len(
self.logger.info("Submitting %i device-requets to mobileraker server", len(
request.device_requests))
self.logger.debug("Sending to firebase fcm (%s): %s",
self.fcm_uri, jsons)
Expand Down
15 changes: 7 additions & 8 deletions mobileraker/service/data_sync_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@ class DataSyncService:
Attributes:
jrpc (MoonrakerClient): The MoonrakerClient instance used for communication.
printer_name (str): The name of the printer.
loop (AbstractEventLoop): The event loop used for handling asynchronous tasks.
klippy_ready (bool): A flag indicating whether Klippy is ready or not.
server_info (ServerInfo): An instance of ServerInfo to hold server-related data.
print_stats (PrintStats): An instance of PrintStats to hold printer stats data.
display_status (DisplayStatus): An instance of DisplayStatus to hold display status data.
virtual_sdcard (VirtualSDCard): An instance of VirtualSDCard to hold virtual SD card data.
resync_retries (int): The number of retries to perform when resyncing data.
'''

def __init__(
Expand Down Expand Up @@ -124,9 +121,11 @@ def _parse_objects(self, status_objects: Dict[str, Any], err: Optional[str] = No
self.filament_sensors[object_name] = sensor.updateWith(object_data)

elif rawObjectKey == 'gcode_macro TIMELAPSE_TAKE_FRAME':
# Using the self.timelapse_pause as fallback is required here since the object might be missing. In that case we want to keep the current state.
self.timelapse_pause = object_data.get('is_paused', self.timelapse_pause)
self._logger.debug("Timelapse is paused: %s", self.timelapse_pause)
# check if the is_paused key is present in the object_data and needs to be updated
if 'is_paused' in object_data:
self.timelapse_pause = object_data['is_paused']
self._logger.info("Timelapse is paused: %s", self.timelapse_pause)


# Kinda hacky but this works!
# It would be better if the _notify_listeners()/sync current file is called in a different context since this method should only parse!
Expand Down

0 comments on commit 3b3b3df

Please sign in to comment.