Skip to content

Commit 0c07311

Browse files
authored
Merge pull request #1092 from sechkova/updater_logging
Improve updater and tests logging
2 parents b9f7cb3 + 963ed79 commit 0c07311

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

tuf/client/updater.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,12 +1151,12 @@ def neither_403_nor_404(mirror_error):
11511151
# Otherwise, reraise the error, because it is not a simple HTTP
11521152
# error.
11531153
if neither_403_nor_404(mirror_error):
1154-
logging.exception('Misc error for root version '+str(next_version))
1154+
logger.exception('Misc error for root version '+str(next_version))
11551155
raise
11561156
else:
11571157
# Calling this function should give us a detailed stack trace
11581158
# including an HTTP error code, if any.
1159-
logging.exception('HTTP error for root version '+str(next_version))
1159+
logger.exception('HTTP error for root version '+str(next_version))
11601160
# If we are here, then we ran into only 403 / 404 errors, which are
11611161
# good reasons to suspect that the next root metadata file does not
11621162
# exist.

tuf/log.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
# the standard pattern of logging.getLogger(__name__)
119119
logger = logging.getLogger('tuf')
120120
logger.setLevel(_DEFAULT_LOG_LEVEL)
121+
logger.addHandler(logging.NullHandler())
121122

122123
# Set the built-in file handler. Messages will be logged to
123124
# 'settings.LOG_FILENAME', and only those messages with a log level of

0 commit comments

Comments
 (0)