Skip to content

Commit

Permalink
Fix: Log only error messages in uptime monitor tasks (#2181)
Browse files Browse the repository at this point in the history
  • Loading branch information
sainak authored May 20, 2024
1 parent 01c4aa0 commit 5c715f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions care/facility/tasks/asset_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def check_asset_status():
)
else:
result = asset_class.api_get(asset_class.get_url("devices/status"))
except Exception:
logger.warn(f"Middleware {resolved_middleware} is down", exc_info=True)
except Exception as e:
logger.warn(f"Middleware {resolved_middleware} is down", e)

# If no status is returned, setting default status as down
if not result or "error" in result:
Expand Down Expand Up @@ -116,5 +116,5 @@ def check_asset_status():
status=new_status.value,
timestamp=status_record.get("time", timezone.now()),
)
except Exception:
logger.error("Error in Asset Status Check", exc_info=True)
except Exception as e:
logger.error("Error in Asset Status Check", e)
8 changes: 4 additions & 4 deletions care/facility/tasks/location_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def check_location_status():
if result:
new_status = AvailabilityStatus.OPERATIONAL

except Exception:
logger.warn(f"Middleware {resolved_middleware} is down", exc_info=True)
except Exception as e:
logger.warn(f"Middleware {resolved_middleware} is down", e)

# Fetching the last record of the location
last_record = (
Expand All @@ -75,5 +75,5 @@ def check_location_status():
timestamp=timezone.now(),
)
logger.info(f"Location {location.external_id} status: {new_status.value}")
except Exception:
logger.error("Error in Location Status Check", exc_info=True)
except Exception as e:
logger.error("Error in Location Status Check", e)

0 comments on commit 5c715f8

Please sign in to comment.