Skip to content

Commit

Permalink
Improve logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed Aug 16, 2024
1 parent 0f46da2 commit a3ea052
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions megalinter/reporters/ApiReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,18 @@ def send_to_api(self):
else:
logging.warning(
f"[Api Reporter] Error posting data to {self.api_url} ({response.status_code})\n"
f"Api request: {json.dumps(obj=self.payloadFormatted, indent=True)}\n"
f"API response: {response.text}"
f"[Api Reporter] Api request: {json.dumps(obj=self.payloadFormatted, indent=True)}\n"
f"[Api Reporter] API response: {response.text}"
)
except ConnectionError as e:
logging.warning(
f"[Api Reporter] Error posting data to {self.api_url}:"
f"Connection error {str(e)}"
f"[Api Reporter] Connection error {str(e)}"
)
except Exception as e:
logging.warning(
f"[Api Reporter] Error posting data to {self.api_url}:"
f"Connection error {str(e)}"
f"[Api Reporter] Connection error {str(e)}"
)

# Build something like:
Expand Down Expand Up @@ -323,16 +323,16 @@ def send_to_metrics_api(self):
else:
logging.warning(
f"[Api Reporter Metrics] Error posting data to {self.api_url} ({response.status_code})\n"
f"Api request: {json.dumps(obj=self.payloadFormatted, indent=True)}\n"
f"API response: {response.text}"
f"[Api Reporter Metrics] Api request: {json.dumps(obj=self.payloadFormatted, indent=True)}\n"
f"[Api Reporter Metrics] API response: {response.text}"
)
except ConnectionError as e:
logging.warning(
f"[Api Reporter Metrics] Error posting data to {self.api_url}:"
f"Connection error {str(e)}"
f"[Api Reporter Metrics] Connection error {str(e)}"
)
except Exception as e:
logging.warning(
f"[Api Reporter Metrics] Error posting data to {self.api_url}:"
f"Connection error {str(e)}"
f"[Api Reporter Metrics] Connection error {str(e)}"
)

0 comments on commit a3ea052

Please sign in to comment.