Skip to content

Commit

Permalink
Avoid redundant message if debug on (#913)
Browse files Browse the repository at this point in the history
Only print the message to use "--debug" if debug logging not already
turned on.

Closes #883

Signed-off-by: Eric Brown <eric_wade_brown@yahoo.com>
  • Loading branch information
ericwb committed Jun 25, 2022
1 parent 44c05fc commit e15fe9b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bandit/core/manager.py
Expand Up @@ -331,12 +331,13 @@ def _parse_file(self, fname, fdata, new_files_list):
new_files_list.remove(fname)
except Exception as e:
LOG.error(
"Exception occurred when executing tests against "
'%s. Run "bandit --debug %s" to see the full '
"traceback.",
"Exception occurred when executing tests against %s.",
fname,
fname,
)
if not LOG.isEnabledFor(logging.DEBUG):
LOG.error('Run "bandit --debug %s" to see the full traceback.')

self.skipped.append((fname, "exception while scanning file"))
new_files_list.remove(fname)
LOG.debug(" Exception string: %s", e)
Expand Down

0 comments on commit e15fe9b

Please sign in to comment.