summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup/log.py
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-05-30 23:33:17 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-05-30 23:33:17 +0000
commitb3c458f96706b7a6ef570434c9c9adc7129912a4 (patch)
tree147d094408050f337c1ac9b752f61e3be7a23bda /rdiff-backup/rdiff_backup/log.py
parent316b6ac203137fc5740d1181c941aab1178eeaae (diff)
downloadrdiff-backup-b3c458f96706b7a6ef570434c9c9adc7129912a4.tar.gz
Bug fixes to resuming and error correction code
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@112 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/log.py')
-rw-r--r--rdiff-backup/rdiff_backup/log.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/rdiff-backup/rdiff_backup/log.py b/rdiff-backup/rdiff_backup/log.py
index f7e4a89..3b9c08a 100644
--- a/rdiff-backup/rdiff_backup/log.py
+++ b/rdiff-backup/rdiff_backup/log.py
@@ -1,4 +1,4 @@
-import time, sys
+import time, sys, traceback
execfile("lazy.py")
#######################################################################
@@ -121,7 +121,13 @@ class Logger:
Globals.Main.cleanup()
sys.exit(1)
- def exception(self, only_terminal = 0, verbosity = 4):
+ def exception_to_string(self):
+ """Return string version of current exception"""
+ type, value, tb = sys.exc_info()
+ return ("Exception '%s' raised of class '%s':\n%s" %
+ (value, type, "".join(traceback.format_tb(tb))))
+
+ def exception(self, only_terminal = 0, verbosity = 5):
"""Log an exception and traceback
If only_terminal is None, log normally. If it is 1, then only
@@ -135,9 +141,6 @@ class Logger:
logging_func = self.__call__
else: logging_func = self.log_to_term
- exc_info = sys.exc_info()
- logging_func("Exception %s raised of class %s" %
- (exc_info[1], exc_info[0]), verbosity)
- logging_func("".join(traceback.format_tb(exc_info[2])), verbosity+1)
+ logging_func(self.exception_to_string(), verbosity)
Log = Logger()