From 2b4d0f0c4d6ec270eca891321ee9d24cb6a415cf Mon Sep 17 00:00:00 2001 From: Sachin Agarwal Date: Tue, 21 Dec 2021 14:24:40 -0500 Subject: [PATCH] Added a generic try-except block to catch any datadog logging errors while running nice subprocess --- opta/nice_subprocess.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/opta/nice_subprocess.py b/opta/nice_subprocess.py index c1352f39f..b4df7698b 100644 --- a/opta/nice_subprocess.py +++ b/opta/nice_subprocess.py @@ -24,19 +24,24 @@ def log_to_datadog(msg: str, severity: str) -> None: - msg = ansi_scrub(msg) - if hasattr(sys, "_called_from_test") or VERSION == DEV_VERSION or not VERSION: - if os.environ.get("OPTA_DEBUG", "") == "DATADOG_LOCAL": - print("Would have logged this string to DD:\n") - print(">>>>>>>>>>>>>>>>>>>>Datadog log start") - print(msg) - print("<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>Datadog log start") + print(msg) + print("<<<<<<<<<<<<<<<<<<< None: