Пример #1
0
    def test_configure_default(self):
        """Testing function Logger.configure_default."""
        logging_format = "%(asctime)-15s - %(name)s - %(message)s"
        logging_level = logging.DEBUG

        with patch('logging.basicConfig') as mocked_logging_basicConfig:
            Logger.configure_default(logging_format, logging_level)
            mocked_logging_basicConfig.assert_called_with(
                format=logging_format, level=logging_level)

        assert_that(Logger.use_external_configuration, equal_to(False))
Пример #2
0
    def setup_logging(self):
        """Setup of application logging."""
        is_custom_logging = len(self.options.logging_config) > 0
        is_custom_logging = is_custom_logging and os.path.isfile(
            self.options.logging_config)
        is_custom_logging = is_custom_logging and not self.options.dry_run

        if is_custom_logging:
            Logger.configure_by_file(self.options.logging_config)
        else:
            logging_format = "%(asctime)-15s - %(name)s - %(message)s"
            if self.options.dry_run:
                logging_format = "%(name)s - %(message)s"
            Logger.configure_default(logging_format, self.logging_level)
Пример #3
0
 def setup_logging(self):
     """Setup of application logging."""
     logging_format = "%(asctime)-15s - %(name)s - %(message)s"
     Logger.configure_default(logging_format, self.logging_level)