@@ -139,11 +139,8 @@ def __init__(self, path_to_tuf_config_file):
139
139
os .environ .get ('TUF_ENABLE_LOGGING' , False )
140
140
141
141
if enable_logging :
142
- # https://github.com/theupdateframework/tuf/pull/749
143
- log_filename = os .path .join (tuf .settings .repositories_directory ,
144
- tuf_config ['repository_dir' ],
145
- 'tuf.log' )
146
- tuf .log .enable_file_logging (log_filename )
142
+ # NOTE: Also set TUF output to DEBUG and above.
143
+ logging .getLogger ("tuf" ).setLevel (logging .DEBUG )
147
144
148
145
# Also set verbose, non-quiet in-toto logging.
149
146
# https://github.com/in-toto/in-toto/blob/8eb8eab8c94f47e67a24b5e7d56f4519092dd9d2/in_toto/in_toto_verify.py#L205
@@ -290,7 +287,7 @@ def __verify_in_toto_metadata(self, target_relpath,
290
287
params = self .__substitute_parameters (target_relpath )
291
288
verifylib .in_toto_verify (layout , layout_key_dict ,
292
289
substitution_parameters = params )
293
- logging .info ('E2E verified {}' .format (target_relpath ))
290
+ logger .info ('in-toto verified {}' .format (target_relpath ))
294
291
except :
295
292
logger .exception ('in-toto failed to verify {}' \
296
293
.format (target_relpath ))
@@ -326,9 +323,7 @@ def _get_target(self, target_relpath, download_in_toto_metadata=True):
326
323
327
324
# Either the target has not been updated...
328
325
if not len (updated_targets ):
329
- logger .info ('{} has not been updated' \
330
- .format (target_relpath ))
331
-
326
+ logger .debug ('{} has not been updated' .format (target_relpath ))
332
327
# or, it has been updated, in which case...
333
328
else :
334
329
# First, we use TUF to download and verify the target.
@@ -337,6 +332,8 @@ def _get_target(self, target_relpath, download_in_toto_metadata=True):
337
332
assert updated_target == target
338
333
self .__updater .download_target (updated_target , self .__targets_dir )
339
334
335
+ logger .info ('TUF verified {}' .format (target_relpath ))
336
+
340
337
# Next, we use in-toto to verify the supply chain of the target.
341
338
# NOTE: We use a flag to avoid recursively downloading in-toto
342
339
# metadata for in-toto metadata themselves, and so on ad infinitum.
@@ -355,8 +352,8 @@ def _get_target(self, target_relpath, download_in_toto_metadata=True):
355
352
not target_relpath .endswith ('.html' ):
356
353
self .__download_and_verify_in_toto_metadata (target , target_relpath )
357
354
else :
358
- logging .warning ('Switched off in-toto verification for {}' \
359
- .format (target_relpath ))
355
+ logger .warning ('Switched off in-toto verification for {}' \
356
+ .format (target_relpath ))
360
357
361
358
target_path = os .path .join (self .__targets_dir , target_relpath )
362
359
return target_path
@@ -385,12 +382,12 @@ def download(self, target_relpath, dest_dir, dest_filename):
385
382
import tuf .log
386
383
import tuf .settings
387
384
388
- # NOTE: By default, we turn off TUF logging, and use the pip log instead.
389
- # You may turn toggle this behaviour using the "enable_logging" flag in the
390
- # TUF configuration file.
385
+ # We *always* turn off TUF logging.
391
386
tuf .settings .ENABLE_FILE_LOGGING = False
392
- # NOTE: We set the TUF console logging level to CRITICAL and above .
387
+ # By default, set the TUF console logging level to >= CRITICAL .
393
388
logging .getLogger ("tuf" ).setLevel (logging .CRITICAL )
389
+ # Also set non-verbose, quiet in-toto logging.
390
+ logging .getLogger ("in_toto" ).setLevelVerboseOrQuiet (False , True )
394
391
from tuf .client .updater import Updater
395
392
396
393
from in_toto import verifylib
0 commit comments