7 orig_stdout_fd = os.dup(1)
8 orig_stderr_fd = os.dup(2)
9 progress_file = os.fdopen(orig_stdout_fd, "w", 0)
15 self.progress_file = progress_file
19 self.log_file = open(name, "w")
20 os.dup2(self.log_file.fileno(), 1)
21 os.dup2(self.log_file.fileno(), 2)
25 self.log_file.write(msg)
27 def verbose(self, msg):
28 if self.verbosity and self.log_file:
29 self.log_file.write(msg)
31 def progress(self, msg):
32 if self.progress_file:
33 self.progress_file.write(msg)
44 def fatal_exception():
45 os.dup2(orig_stderr_fd, 2)