Skip to content

Commit

Permalink
[FIX] logging interpolation
Browse files Browse the repository at this point in the history
To play nice with Sentry.
  • Loading branch information
sbidoul authored and Ernesto Tejeda committed Mar 16, 2020
1 parent 77d9514 commit f7cfc1d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
6 changes: 4 additions & 2 deletions github_connector/models/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ def get_by_url(self, url, call_type, data=False):
data=json_data)
break
except Exception as err:
_logger.warning("URL Call Error. %d/%d. URL: %s" % (
i, self.max_try, err.__str__()))
_logger.warning(
"URL Call Error. %d/%d. URL: %s",
i, self.max_try, err.__str__(),
)
else:
raise exceptions.Warning(_('Maximum attempts reached.'))

Expand Down
5 changes: 3 additions & 2 deletions github_connector/models/github_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def button_sync_branch(self):
branch_ids.append(branch.id)
else:
_logger.warning(
"the branch '%s'/'%s' has been ignored." % (
repository.name, data['name']))
"the branch '%s'/'%s' has been ignored.",
repository.name, data['name'],
)
repository.branch_ids = branch_ids
10 changes: 5 additions & 5 deletions github_connector/models/github_repository_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _download_code(self):
_logger.warning(_(
"Error when updating the branch %s in the local folder"
" %s.\n Deleting the local folder and trying"
" again.") % (branch.name, branch.local_path))
" again."), branch.name, branch.local_path)
command = "rm -r %s" % branch.local_path
os.system(command)
branch._download_code()
Expand Down Expand Up @@ -198,7 +198,7 @@ def analyze_code_one(self, branch):
size += os.path.getsize(file_path)
except Exception:
_logger.warning(
"Warning : unable to eval the size of '%s'." % file_path)
"Warning : unable to eval the size of '%s'.", file_path)

try:
Repo(path)
Expand All @@ -219,9 +219,9 @@ def _analyze_code(self):
path = branch.local_path
if not os.path.exists(path):
_logger.warning(
"Warning Folder %s not found: Analysis skipped." % path)
"Warning Folder %s not found: Analysis skipped.", path)
else:
_logger.info("Analyzing Source Code in %s ..." % path)
_logger.info("Analyzing Source Code in %s ...", path)
try:
vals = branch.analyze_code_one(branch)
vals.update({
Expand All @@ -236,7 +236,7 @@ def _analyze_code(self):
except Exception as e:
_logger.warning(
'Cannot analyze branch %s so skipping it, error '
'is: %s' % (branch.name, e))
'is: %s', branch.name, e)
return True

# Compute Section
Expand Down

0 comments on commit f7cfc1d

Please sign in to comment.