Skip to content

Commit

Permalink
Merge pull request #70 from statsig-io/reduce-log-level
Browse files Browse the repository at this point in the history
reduce log error with network exceptions
  • Loading branch information
jkw-statsig authored May 18, 2022
2 parents 9389976 + 511fe14 commit 5490acd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions statsig/statsig_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def post_request(self, endpoint, payload):
else:
return None
except Exception as e:
self.__log.exception('Request to %s failed', endpoint)
self.__log.warning(
'Network exception caught when making request to %s failed', endpoint)
return None

def retryable_request(self, endpoint, payload):
Expand All @@ -61,10 +62,12 @@ def retryable_request(self, endpoint, payload):
if response.status_code in self.__RETRY_CODES:
return payload
elif response.status_code >= 300:
self.__log.error("Request to %s failed with code %d", endpoint, response.status_code)
self.__log.warning(
"Request to %s failed with code %d", endpoint, response.status_code)
return None
except Exception as e:
self.__log.exception("Request to %s failed", endpoint)
except Exception:
self.__log.warning(
"Network exception caught when making request to %s failed", endpoint)
return None

def get_request(self, url, headers):
Expand All @@ -78,6 +81,7 @@ def get_request(self, url, headers):
return response
else:
return None
except:
self.__log.exception('Request to %s failed', url)
except Exception:
self.__log.warning(
'Network exception caught when making request to %s failed', url)
return None

0 comments on commit 5490acd

Please sign in to comment.