improve debug output in TarFile
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 21 Jul 2016 15:38:51 +0000 (17:38 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Fri, 12 Nov 2021 12:32:59 +0000 (13:32 +0100)
- clarify in debug output from TarFile._dbg where it comes from via prefix
- mention name of new volume in output

deltatar/tarfile.py

index 6763e7c..9be864a 100644 (file)
@@ -2783,7 +2783,7 @@ class TarFile(object):
             self._extfileobj = False
 
             if isinstance(self.fileobj, _Stream):
-                self._dbg(3, 'open_volume: create a _Stream')
+                self._dbg(3, 'open_volume: create a _Stream for ' + name)
                 fileobj = _Stream(name=name,
                             mode=self.fileobj.mode,
                             comptype=self.fileobj.comptype,
@@ -2794,7 +2794,7 @@ class TarFile(object):
                             tolerance=self.fileobj.tolerance)
             else:
                 # here, we lose information about compression/encryption!
-                self._dbg(3, 'open_volume: builtin open')
+                self._dbg(3, 'open_volume: builtin open for ' + name)
                 fileobj = bltn_open(name, self._mode)
         else:
             if name is None and hasattr(fileobj, "name"):
@@ -3301,7 +3301,7 @@ class TarFile(object):
         """Write debugging output to sys.stderr.
         """
         if level <= self.debug:
-            print(msg.format(*args), file=sys.stderr)
+            print('TarFile debug: ' + msg.format(*args), file=sys.stderr)
 
     def __enter__(self):
         self._check()