当前位置: 首页>>代码示例>>Python>>正文


Python logs.start_logging函数代码示例

本文整理汇总了Python中pulp.server.logs.start_logging函数的典型用法代码示例。如果您正苦于以下问题:Python start_logging函数的具体用法?Python start_logging怎么用?Python start_logging使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了start_logging函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_root_logger_configured_console

    def test_root_logger_configured_console(self, getLogger, get):
        """
        This test ensures that the root logger is configured appropriately when
        console logging set.
        """
        root_logger = mock.MagicMock(spec=logging.Logger)
        root_logger.manager = mock.MagicMock()
        root_logger.manager.loggerDict = {}

        def fake_getLogger(name=None):
            if name is None:
                return root_logger
            if name not in root_logger.manager.loggerDict:
                root_logger.manager.loggerDict[name] = mock.MagicMock()
            return root_logger.manager.loggerDict[name]
        getLogger.side_effect = fake_getLogger

        logs.start_logging()

        # Let's make sure the handler is setup right
        self.assertEqual(root_logger.addHandler.call_count, 1)
        root_handler = root_logger.addHandler.mock_calls[0][1][0]
        self.assertTrue(isinstance(root_handler, logging.StreamHandler))

        # And the handler should have the formatter with our format string
        self.assertTrue(isinstance(root_handler.formatter, logs.TaskLogFormatter))
开发者ID:release-engineering,项目名称:pulp,代码行数:26,代码来源:test_logs.py

示例2: test_calls__captureWarnings

    def test_calls__captureWarnings(self, _logging):
        """
        Ensure that start_logging() calls captureWarnings().
        """
        logs.start_logging()

        _logging.captureWarnings.assert_called_once_with(True)
开发者ID:nareshbatthula,项目名称:pulp,代码行数:7,代码来源:test_logs.py

示例3: _start_logging

def _start_logging():
    """
    Call into Pulp to get the logging started, and set up the logger to be used in this module.
    """
    global logger
    logs.start_logging()
    logger = logging.getLogger(__name__)
开发者ID:unixbhaskar,项目名称:pulp,代码行数:7,代码来源:manage.py

示例4: test_calls__blacklist_loggers

    def test_calls__blacklist_loggers(self, getLogger, get, _blacklist_loggers):
        """
        Ensure that start_logging() calls _blacklist_loggers().
        """
        logs.start_logging()

        _blacklist_loggers.assert_called_once_with()
开发者ID:nareshbatthula,项目名称:pulp,代码行数:7,代码来源:test_logs.py

示例5: test_root_logger_configured

    def test_root_logger_configured(self, getLogger, get):
        """
        This test ensures that the root logger is configured appropriately.
        """
        root_logger = mock.MagicMock(spec=logging.Logger)
        root_logger.manager = mock.MagicMock()
        root_logger.manager.loggerDict = {}

        def fake_getLogger(name=None):
            if name is None:
                return root_logger
            if name not in root_logger.manager.loggerDict:
                root_logger.manager.loggerDict[name] = mock.MagicMock()
            return root_logger.manager.loggerDict[name]

        getLogger.side_effect = fake_getLogger

        logs.start_logging()

        # Let's make sure the handler is setup right
        self.assertEqual(root_logger.addHandler.call_count, 1)
        root_handler = root_logger.addHandler.mock_calls[0][1][0]
        self.assertTrue(isinstance(root_handler, logs.CompliantSysLogHandler))
        self.assertEqual(root_handler.address, os.path.join("/", "dev", "log"))
        self.assertEqual(root_handler.facility, logs.CompliantSysLogHandler.LOG_DAEMON)

        # And the handler should have the formatter with our format string
        self.assertEqual(root_handler.formatter._fmt, logs.LOG_FORMAT_STRING)
开发者ID:nareshbatthula,项目名称:pulp,代码行数:28,代码来源:test_logs.py

示例6: setUpClass

 def setUpClass(cls):
     if not os.path.exists('/tmp/pulp'):
         os.makedirs('/tmp/pulp')
     stop_logging()
     config_filename = os.path.join(TEST_DATA_DIR, 'test-override-pulp.conf')
     config.config.read(config_filename)
     start_logging()
     manager_factory.initialize()
     constants.DISTRIBUTION_STORAGE_PATH = TEMP_DISTRO_STORAGE_DIR
开发者ID:ATIX-AG,项目名称:pulp_rpm,代码行数:9,代码来源:rpm_support_base.py

示例7: test_calls__captureWarnings_with_attribute_error

    def test_calls__captureWarnings_with_attribute_error(self, _logging):
        """
        Ensure that start_logging() calls captureWarnings() and handles AttributeError
        The validation for this is that the AttributeError is swallowed.
        """
        _logging.captureWarnings.side_effect = AttributeError

        logs.start_logging()

        _logging.captureWarnings.assert_called_once_with(True)
开发者ID:nareshbatthula,项目名称:pulp,代码行数:10,代码来源:test_logs.py

示例8: setUpClass

 def setUpClass(cls):
     if not os.path.exists('/tmp/pulp'):
         os.makedirs('/tmp/pulp')
     stop_logging()
     config_filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data', 'test-override-pulp.conf')
     config.config.read(config_filename)
     start_logging()
     name = config.config.get('database', 'name')
     connection.initialize(name)
     manager_factory.initialize()
开发者ID:ehelms,项目名称:pulp,代码行数:10,代码来源:rpm_support_base.py

示例9: _start_logging

def _start_logging():
    """
    Call into Pulp to get the logging started, and set up the logger to be used in this module.
    """
    global logger
    logs.start_logging()
    logger = logging.getLogger(__name__)
    console_handler = logging.StreamHandler()
    console_handler.setLevel(logging.INFO)
    logger.root.addHandler(console_handler)
开发者ID:CUXIDUMDUM,项目名称:pulp,代码行数:10,代码来源:manage.py

示例10: setUpClass

 def setUpClass(cls):
     if not os.path.exists('/tmp/pulp'):
         os.makedirs('/tmp/pulp')
     stop_logging()
     config_filename = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                                    '../../../pulp_rpm/test/unit/data', 'test-override-pulp.conf')
     config.config.read(config_filename)
     start_logging()
     name = config.config.get('database', 'name')
     connection.initialize(name)
     manager_factory.initialize()
     constants.DISTRIBUTION_STORAGE_PATH = TEMP_DISTRO_STORAGE_DIR
开发者ID:preethit,项目名称:pulp_rpm,代码行数:12,代码来源:rpm_support_base.py

示例11: load_test_config

def load_test_config():
    if not os.path.exists('/tmp/pulp'):
        os.makedirs('/tmp/pulp')

    override_file = os.path.join(DATA_DIR, 'test-override-pulp.conf')
    stop_logging()
    try:
        config.add_config_file(override_file)
    except RuntimeError:
        pass
    start_logging()

    return config.config
开发者ID:AndreaGiardini,项目名称:pulp,代码行数:13,代码来源:base.py

示例12: load_test_config

def load_test_config():
    if not os.path.exists('/tmp/pulp'):
        os.makedirs('/tmp/pulp')

    override_file = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data', 'test-override-pulp.conf')
    override_repo_file = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data', 'test-override-repoauth.conf')
    stop_logging()
    try:
        config.add_config_file(override_file)
        config.add_config_file(override_repo_file)
    except RuntimeError:
        pass
    start_logging()

    return config.config
开发者ID:ehelms,项目名称:pulp,代码行数:15,代码来源:base.py

示例13: _start_logging

def _start_logging():
    """
    Call into Pulp to get the logging started, and set up the _logger to be used in this module.
    """
    global _logger
    logs.start_logging()
    _logger = logging.getLogger(__name__)
    console_handler = logging.StreamHandler()
    console_handler.setLevel(logging.INFO)
    _logger.root.addHandler(console_handler)
    # Django will un-set our default ignoring DeprecationWarning *unless* sys.warnoptions is set.
    # So, set it as though '-W ignore::DeprecationWarning' was passed on the commandline. Our code
    # that sets DeprecationWarnings as ignored also checks warnoptions, so this must be added after
    # pulp.server.logs.start_logging is called but before Django is initialized.
    sys.warnoptions.append('ignore::DeprecationWarning')
开发者ID:alexxa,项目名称:pulp,代码行数:15,代码来源:manage.py

示例14: _load_test_config

def _load_test_config():
    """
    Load the test database configuration information.
    """
    stop_logging()

    config.config.set('database', 'name', 'pulp_unittest')
    config.config.set('server', 'storage_dir', '/tmp/pulp')

    # Prevent the tests from altering the config so that nobody accidentally makes global changes
    config.config.set = _enforce_config
    config.load_configuration = _enforce_config
    config.__setattr__ = _enforce_config
    config.config.__setattr__ = _enforce_config

    start_logging()
开发者ID:jeremycline,项目名称:pulp,代码行数:16,代码来源:base.py

示例15: setUpClass

 def setUpClass(cls):
     if not os.path.exists(cls.TMP_ROOT):
         os.makedirs(cls.TMP_ROOT)
     stop_logging()
     path = os.path.join(
         os.path.abspath(os.path.dirname(__file__)),
         'data',
         'pulp.conf')
     pulp_conf.read(path)
     start_logging()
     storage_dir = pulp_conf.get('server', 'storage_dir')
     if not os.path.exists(storage_dir):
         os.makedirs(storage_dir)
     shutil.rmtree(storage_dir+'/*', ignore_errors=True)
     name = pulp_conf.get('database', 'name')
     connection.initialize(name)
     managers.initialize()
开发者ID:domcleal,项目名称:pulp,代码行数:17,代码来源:base.py


注:本文中的pulp.server.logs.start_logging函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。