Skip to content

Commit

Permalink
replace logging.warn with logger.warning, logger is defined and warn …
Browse files Browse the repository at this point in the history
…is deprecated after py3.3
  • Loading branch information
wenzhe-log10 committed Sep 25, 2024
1 parent e38cf35 commit 1f40794
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions log10/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ async def log_async(completion_url, log_row):
organizationSlug = res.json().get("organizationSlug", None)

if completionID is None:
logging.warn("LOG10: failed to get completionID from log10. Skipping log.")
logger.warning("LOG10: failed to get completionID from log10. Skipping log.")
return None

if DEBUG:
Expand All @@ -205,15 +205,15 @@ async def log_async(completion_url, log_row):
_url = f"{completion_url}/{completionID}"
res = post_request(_url, log_row)
except Exception as e:
logging.warn(f"LOG10: failed to log: {e}. Skipping")
logger.warning(f"LOG10: failed to log: {e}. Skipping")
return None

elif target_service == "bigquery":
pass
# NOTE: We only save on request finalization.

except Exception as e:
logging.warn(f"LOG10: failed to log: {e}. Skipping")
logger.warning(f"LOG10: failed to log: {e}. Skipping")
return None

return {"completionID": completionID, "organizationSlug": organizationSlug}
Expand All @@ -233,15 +233,15 @@ def log_sync(completion_url, log_row):
completionID = res.json().get("completionID", None)

if completionID is None:
logging.warn("LOG10: failed to get completionID from log10. Skipping log.")
logger.warning("LOG10: failed to get completionID from log10. Skipping log.")
return None

if DEBUG:
log_url(res, completionID)
_url = f"{completion_url}/{completionID}"
res = post_request(_url, log_row)
except Exception as e:
logging.warn(f"LOG10: failed to get completionID from log10: {e}")
logger.warning(f"LOG10: failed to get completionID from log10: {e}")
return None

return completionID
Expand Down Expand Up @@ -388,7 +388,7 @@ def __next__(self):
logger.error(f"LOG10: failed to insert in log10: {self.partial_log_row} with error {res.text}")
except Exception as e:
traceback.print_tb(e.__traceback__)
logging.warn(f"LOG10: failed to log: {e}. Skipping")
logger.warning(f"LOG10: failed to log: {e}. Skipping")

raise se

Expand Down Expand Up @@ -578,7 +578,7 @@ def wrapper(*args, **kwargs):
completionID = log_sync(completion_url=completion_url, log_row=log_row)

if completionID is None:
logging.warn("LOG10: failed to get completionID from log10. Skipping log.")
logger.warning("LOG10: failed to get completionID from log10. Skipping log.")
func_with_backoff(func, *args, **kwargs)
return

Expand Down Expand Up @@ -742,7 +742,7 @@ def wrapper(*args, **kwargs):
if res.status_code != 200:
logger.error(f"LOG10: failed to insert in log10: {log_row} with error {res.text}")
except Exception as e:
logging.warn(f"LOG10: failed to log: {e}. Skipping")
logger.warning(f"LOG10: failed to log: {e}. Skipping")

elif target_service == "bigquery":
try:
Expand Down

0 comments on commit 1f40794

Please sign in to comment.