adding some missing debug lines
authorEduardo Robles Elvira <edulix@wadobo.com>
Wed, 5 Feb 2014 10:21:10 +0000 (11:21 +0100)
committerEduardo Robles Elvira <edulix@wadobo.com>
Wed, 5 Feb 2014 10:21:10 +0000 (11:21 +0100)
deltatar/deltatar.py

index 53916d7..d909077 100644 (file)
@@ -587,6 +587,8 @@ class DeltaTar(object):
             if tarobj.fileobj is not None:
                 tarobj.fileobj.close()
 
+            deltarobj.logger.debug("opening volume %s" % volume_path)
+
             tarobj.open_volume(volume_path)
 
         # wraps some args from context into the handler
@@ -625,6 +627,7 @@ class DeltaTar(object):
 
             # retrieve file offset
             statd['offset'] = tarobj.get_last_member_offset()
+            self.logger.debug("backup %s" % statd['path'])
 
             # store in the index the stat dict
             s = bytes(json.dumps(statd) + '\n', 'UTF-8')
@@ -742,6 +745,7 @@ class DeltaTar(object):
             if not os.path.isabs(volume_path):
                 volume_path = os.path.join(cwd, volume_path)
 
+            self.logger.debug("opening volume %s" % volume_path)
             tarobj.open_volume(volume_path)
 
         # wraps some args from context into the handler
@@ -847,6 +851,7 @@ class DeltaTar(object):
                 crc = binascii.crc32(s, crc) & 0xffffffff
                 index_fd.write(s)
 
+        self.logger.debug("backup %s" % stat['path'])
         s = bytes('{"type": "END-FILE-LIST"}\n', 'UTF-8')
         crc = binascii.crc32(s, crc) & 0xffffffff
         index_fd.write(s)
@@ -1150,7 +1155,7 @@ class DeltaTar(object):
 
         def filter(cls, list_func, tarinfo):
             if list_func is None:
-                print(tarinfo.path)
+                self.logger.info(tarinfo.path)
             else:
                 list_func(tarinfo)
             return False
@@ -1273,9 +1278,10 @@ class DeltaTar(object):
                 if ipath['path'].startswith('delete://'):
                     continue
                 try:
+                    self.logger.debug("restore %s" % ipath['path'])
                     helper.restore(ipath, l_no)
                 except Exception as e:
-                    print("FAILED to restore: ", ipath.get('path', ''))
+                    self.logger.error("FAILED to restore: " + ipath.get('path', ''))
                 continue
 
             # if both files are equal, we have nothing to restore
@@ -1290,11 +1296,13 @@ class DeltaTar(object):
             if ipath:
                 if ipath['type'] != 'directory' or ipath['path'].startswith('delete://'):
                     helper.delete(upath)
+                self.logger.debug("restore %s" % ipath['path'])
                 helper.restore(ipath, l_no)
 
             # if the file is not in the index (so it comes from the target
             # directory) then we have to delete it
             else:
+                self.logger.debug("delete %s" % upath['path'])
                 helper.delete(upath)
 
         helper.restore_directories_permissions()