Skip to content

Commit

Permalink
Remove object addresses from log messages so they don't all look unique
Browse files Browse the repository at this point in the history
  • Loading branch information
pnbruckner committed Jun 2, 2019
1 parent 3e6b08c commit 822030d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/amcrest/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#
# vim:sw=4:ts=4:et
import logging
import re
import threading

import requests
Expand Down Expand Up @@ -154,12 +155,12 @@ def _command(self, cmd, retries=None, timeout_cmd=None, stream=False):
raise LoginError
resp.raise_for_status()
except requests.RequestException as error:
msg = re.sub(r'at 0x[0-9a-fA-F]+', 'at ADDRESS', repr(error))
if loop > retries:
_LOGGER.debug(
"%s Query failed due to error: %r", self, error)
"%s Query failed due to error: %s", self, msg)
raise CommError(error)
_LOGGER.warning(
"%s Trying again due to error: %r", self, error)
_LOGGER.warning("%s Trying again due to error: %s", self, msg)
continue
else:
break
Expand Down

0 comments on commit 822030d

Please sign in to comment.