Esempio n. 1
0
    def tearDown(self):
        # Set everything back to the way it was
        log.default_to_console = self.default_to_console_orig
        log.allow_level_override = self.allow_level_override_orig
        log.set_log_level(logging.getLevelName(self.file_level_orig),
                          logging.getLevelName(self.console_level_orig))
        log.set_log_file(self.log_filename_orig)

        # ..and stdout!
        sys.stdout = sys.__stdout__

        # Remove the temporary logfile
        os.remove(self.logfile)
Esempio n. 2
0
 def tearDown(self):
     # Set everything back to the way it was
     log.default_to_console = self.default_to_console_orig
     log.allow_level_override = self.allow_level_override_orig
     log.set_log_level(logging.getLevelName(self.file_level_orig), 
                       logging.getLevelName(self.console_level_orig))
     log.set_log_file(self.log_filename_orig)
     
     # ..and stdout!
     sys.stdout = sys.__stdout__
     
     # Remove the temporary logfile
     os.remove(self.logfile)
Esempio n. 3
0
    def setUp(self):
        # Store current log values
        self.console_level_orig = log.console_logging_level
        self.file_level_orig = log.file_logging_level
        self.default_to_console_orig = log.default_to_console
        self.log_filename_orig = log.log_filename
        self.allow_level_override_orig = log.allow_level_override

        # Redirect stderr and stdout
        self.console = StringIO()
        sys.stdout = self.console

        # Temporary log file
        (handle, self.logfile) = tempfile.mkstemp('.log', 'test_log_')
        os.close(handle)

        # Initialise the new logger
        log.default_to_console = True
        log.allow_level_override = True
        log.set_log_file(self.logfile, log.file_logging_level)
Esempio n. 4
0
 def setUp(self):
     # Store current log values
     self.console_level_orig = log.console_logging_level
     self.file_level_orig = log.file_logging_level
     self.default_to_console_orig = log.default_to_console
     self.log_filename_orig = log.log_filename
     self.allow_level_override_orig = log.allow_level_override
     
     # Redirect stderr and stdout
     self.console = StringIO()
     sys.stdout = self.console
     
     # Temporary log file
     (handle, self.logfile) = tempfile.mkstemp('.log', 'test_log_')
     os.close(handle)
     
     # Initialise the new logger
     log.default_to_console = True
     log.allow_level_override = True
     log.set_log_file(self.logfile, log.file_logging_level)