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


Python stacklog.get_logger函数代码示例

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


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

示例1: test_get_logger_should_create_queue_logger_for_child

 def test_get_logger_should_create_queue_logger_for_child(self):
     logger_name = "logger"
     stacklog.get_logger(logger_name, is_parent=True)
     child_logger = stacklog.get_logger(logger_name, is_parent=False)
     self.assertIsInstance(child_logger.handlers[0], stacklog.QueueHandler)
     self.assertEqual(child_logger.name, "child_logger")
     self.assertEquals(child_logger.level, logging.DEBUG)
开发者ID:meker12,项目名称:stacktach,代码行数:7,代码来源:test_stacklog.py

示例2: setup_mock_log

 def setup_mock_log(self, name=None):
     if name is None:
         stacklog.get_logger(name=mox.IgnoreArg(),
                             is_parent=False).AndReturn(self.log)
     else:
         stacklog.get_logger(name=name,
                             is_parent=False).AndReturn(self.log)
开发者ID:DragonDM,项目名称:stacktach,代码行数:7,代码来源:test_stacktach.py

示例3: test_verify_for_range_with_callback

 def test_verify_for_range_with_callback(self):
     mock_logger = self._setup_mock_logger()
     self.mox.StubOutWithMock(mock_logger, 'info')
     stacklog.get_logger('verifier', is_parent=False).AndReturn(mock_logger)
     mock_logger.info('glance: Adding 0 per-owner exists to queue.')
     mock_logger.info('glance: Adding 2 per-owner exists to queue.')
     callback = self.mox.CreateMockAnything()
     when_max = datetime.datetime.utcnow()
     models.ImageExists.SENT_VERIFYING = 'sent_verifying'
     models.ImageExists.SENT_UNVERIFIED = 'sent_unverified'
     models.ImageExists.PENDING = 'pending'
     models.ImageExists.VERIFYING = 'verifying'
     exist1 = self.mox.CreateMockAnything()
     exist2 = self.mox.CreateMockAnything()
     exist3 = self.mox.CreateMockAnything()
     results = {'owner1': [exist1, exist2], 'owner2': [exist3]}
     models.ImageExists.find_and_group_by_owner_and_raw_id(
         ending_max=when_max,
         status=models.ImageExists.SENT_UNVERIFIED).AndReturn([])
     models.ImageExists.find_and_group_by_owner_and_raw_id(
         ending_max=when_max,
         status=models.ImageExists.PENDING).AndReturn(results)
     exist1.save()
     exist2.save()
     exist3.save()
     for value in results.values():
         self.pool.apply_async(glance_verifier._verify, args=(value,),
                               callback=callback)
     self.mox.ReplayAll()
     self.glance_verifier.verify_for_range(
         when_max, callback=callback)
     self.assertEqual(exist1.status, 'verifying')
     self.assertEqual(exist2.status, 'verifying')
     self.assertEqual(exist3.status, 'verifying')
     self.mox.VerifyAll()
开发者ID:ibravo,项目名称:stacktach,代码行数:35,代码来源:test_glance_verifier.py

示例4: test_get_logger_should_use_default_name_when_name_not_specified

    def test_get_logger_should_use_default_name_when_name_not_specified(self):
        logger = stacklog.get_logger(None, is_parent=True)
        self.assertEquals(logger.name, stacklog.default_logger_name)

        stacklog.set_default_logger_name("default")
        logger = stacklog.get_logger(None, is_parent=True)
        self.assertEquals(logger.name, "default")
开发者ID:meker12,项目名称:stacktach,代码行数:7,代码来源:test_stacklog.py

示例5: test_verify_for_range_with_callback

 def test_verify_for_range_with_callback(self):
     mock_logger = self._setup_mock_logger()
     self.mox.StubOutWithMock(mock_logger, "info")
     stacklog.get_logger("verifier", is_parent=False).AndReturn(mock_logger)
     mock_logger.info("glance: Adding 0 per-owner exists to queue.")
     mock_logger.info("glance: Adding 2 per-owner exists to queue.")
     callback = self.mox.CreateMockAnything()
     when_max = datetime.datetime.utcnow()
     models.ImageExists.SENT_VERIFYING = "sent_verifying"
     models.ImageExists.SENT_UNVERIFIED = "sent_unverified"
     models.ImageExists.PENDING = "pending"
     models.ImageExists.VERIFYING = "verifying"
     exist1 = self.mox.CreateMockAnything()
     exist2 = self.mox.CreateMockAnything()
     exist3 = self.mox.CreateMockAnything()
     results = {"owner1": [exist1, exist2], "owner2": [exist3]}
     models.ImageExists.find_and_group_by_owner_and_raw_id(
         ending_max=when_max, status=models.ImageExists.SENT_UNVERIFIED
     ).AndReturn([])
     models.ImageExists.find_and_group_by_owner_and_raw_id(
         ending_max=when_max, status=models.ImageExists.PENDING
     ).AndReturn(results)
     exist1.save()
     exist2.save()
     exist3.save()
     self.pool.apply_async(glance_verifier._verify, args=([exist3],), callback=callback).InAnyOrder()
     self.pool.apply_async(glance_verifier._verify, args=([exist1, exist2],), callback=callback).InAnyOrder()
     self.mox.ReplayAll()
     self.glance_verifier.verify_for_range(when_max, callback=callback)
     self.assertEqual(exist1.status, "verifying")
     self.assertEqual(exist2.status, "verifying")
     self.assertEqual(exist3.status, "verifying")
     self.mox.VerifyAll()
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:33,代码来源:test_glance_verifier.py

示例6: test_run_no_notifications

 def test_run_no_notifications(self):
     mock_logger = self._create_mock_logger()
     stacklog.get_logger('verifier', is_parent=False).AndReturn(mock_logger)
     self.mox.StubOutWithMock(self.verifier_without_notifications, '_run')
     self.verifier_without_notifications._run()
     self.mox.ReplayAll()
     self.verifier_without_notifications.run()
     self.mox.VerifyAll()
开发者ID:meker12,项目名称:stacktach,代码行数:8,代码来源:test_base_verifier.py

示例7: test_run_notifications_with_routing_keys

 def test_run_notifications_with_routing_keys(self):
     mock_logger = self._create_mock_logger()
     stacklog.get_logger('verifier', is_parent=False).AndReturn(mock_logger)
     self._mock_exchange_create_and_connect(self.verifier_with_notifications)
     self.mox.StubOutWithMock(self.verifier_with_notifications, '_run')
     self.verifier_with_notifications._run(callback=mox.Not(mox.Is(None)))
     self.mox.ReplayAll()
     self.verifier_with_notifications.run()
     self.mox.VerifyAll()
开发者ID:meker12,项目名称:stacktach,代码行数:9,代码来源:test_base_verifier.py

示例8: test_get_logger_should_create_timed_rotating_logger_for_parent

 def test_get_logger_should_create_timed_rotating_logger_for_parent(self):
     logger_name = "logger"
     logger = stacklog.get_logger(logger_name, is_parent=True)
     self.assertIsInstance(logger.handlers[0], logging.handlers.TimedRotatingFileHandler)
     self.assertEquals(logger.handlers[0].when, "MIDNIGHT")
     self.assertEquals(logger.handlers[0].interval, 86400)
     self.assertEquals(logger.handlers[0].backupCount, 6)
     self.assertEqual(logger.name, "logger")
     self.assertEquals(logger.level, logging.DEBUG)
开发者ID:meker12,项目名称:stacktach,代码行数:9,代码来源:test_stacklog.py

示例9: test_run_full

    def test_run_full(self):
        mock_logger = self._create_mock_logger()
        mock_logger.info('exchange: N: None, P: 0, S: 2, E: 0')
        stacklog.get_logger('verifier', is_parent=False).AndReturn(mock_logger)
        stacklog.get_logger('verifier', is_parent=False).AndReturn(mock_logger)

        self.mox.StubOutWithMock(transaction, 'commit_on_success')
        tran = self.mox.CreateMockAnything()
        tran.__enter__().AndReturn(tran)
        tran.__exit__(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg())
        transaction.commit_on_success().AndReturn(tran)
        self._mock_exchange_create_and_connect(self.verifier_with_notifications)
        self.verifier_with_notifications.exchange().AndReturn('exchange')
        self.mox.StubOutWithMock(self.verifier_with_notifications, '_keep_running')
        self.verifier_with_notifications._keep_running().AndReturn(True)
        start = datetime.datetime.utcnow()
        self.mox.StubOutWithMock(self.verifier_with_notifications, '_utcnow')
        self.verifier_with_notifications._utcnow().AndReturn(start)
        self.verifier_with_notifications._utcnow().AndReturn(start)
        settle_offset = {SETTLE_UNITS: SETTLE_TIME}
        ending_max = start - datetime.timedelta(**settle_offset)
        self.mox.StubOutWithMock(self.verifier_with_notifications, 'verify_for_range')
        self.verifier_with_notifications.verify_for_range(ending_max,
                                             callback=mox.Not(mox.Is(None)))
        self.mox.StubOutWithMock(self.verifier_with_notifications, 'reconcile_failed')
        result1 = self.mox.CreateMockAnything()
        result2 = self.mox.CreateMockAnything()
        self.verifier_with_notifications.results = [result1, result2]
        result1.ready().AndReturn(True)
        result1.successful().AndReturn(True)
        result1.get().AndReturn((True, None))
        result2.ready().AndReturn(True)
        result2.successful().AndReturn(True)
        result2.get().AndReturn((True, None))
        self.verifier_with_notifications.reconcile_failed()
        self.mox.StubOutWithMock(time, 'sleep', use_mock_anything=True)
        time.sleep(TICK_TIME)
        self.verifier_with_notifications._keep_running().AndReturn(False)
        self.mox.ReplayAll()

        self.verifier_with_notifications.run()

        self.mox.VerifyAll()
开发者ID:karthikvee,项目名称:stacktach,代码行数:43,代码来源:test_base_verifier.py

示例10: _get_parent_logger

def _get_parent_logger():
    return stacklog.get_logger('verifier', is_parent=True)
开发者ID:DragonDM,项目名称:stacktach,代码行数:2,代码来源:start_verifier.py

示例11: test_get_logger_raise_exception_when_child_created_before_parent

 def test_get_logger_raise_exception_when_child_created_before_parent(self):
     with self.assertRaises(stacklog.ParentLoggerDoesNotExist):
         stacklog.get_logger("logger", is_parent=False)
开发者ID:meker12,项目名称:stacktach,代码行数:3,代码来源:test_stacklog.py

示例12: _setup_mock_logger

 def _setup_mock_logger(self):
     mock_logger = self.mox.CreateMockAnything()
     self.mox.StubOutWithMock(stacklog, 'get_logger')
     stacklog.get_logger('worker', is_parent=False).AndReturn(mock_logger)
     return mock_logger
开发者ID:Priyaag,项目名称:stacktach,代码行数:5,代码来源:test_worker.py

示例13: patterns

from django.conf.urls import patterns, url

from stacktach import stacklog

stacklog.set_default_logger_name('stacktach-web')
web_logger = stacklog.get_logger('stacktach-web')
web_logger_listener = stacklog.LogListener(web_logger)
web_logger_listener.start()

urlpatterns = patterns('',
    url(r'^$', 'stacktach.views.welcome', name='welcome'),
    url(r'stacky/deployments/$', 'stacktach.stacky_server.do_deployments'),
    url(r'stacky/events/$', 'stacktach.stacky_server.do_events'),
    url(r'stacky/hosts/$', 'stacktach.stacky_server.do_hosts'),
    url(r'stacky/uuid/$', 'stacktach.stacky_server.do_uuid'),
    url(r'stacky/timings/$', 'stacktach.stacky_server.do_timings'),
    url(r'stacky/timings/uuid/$', 'stacktach.stacky_server.do_timings_uuid'),
    url(r'stacky/summary/$', 'stacktach.stacky_server.do_summary'),
    url(r'stacky/request/$', 'stacktach.stacky_server.do_request'),
    url(r'stacky/reports/$', 'stacktach.stacky_server.do_jsonreports'),
    url(r'stacky/report/(?P<report_id>\d+)/$',
                            'stacktach.stacky_server.do_jsonreport'),
    url(r'stacky/show/(?P<event_id>\d+)/$',
                                        'stacktach.stacky_server.do_show'),
    url(r'stacky/watch/(?P<deployment_id>\d+)/$',
                                        'stacktach.stacky_server.do_watch'),
    url(r'stacky/search/$', 'stacktach.stacky_server.search'),
    url(r'stacky/kpi/$', 'stacktach.stacky_server.do_kpi'),
    url(r'stacky/kpi/(?P<tenant_id>\w+)/$', 'stacktach.stacky_server.do_kpi'),
    url(r'stacky/usage/launches/$',
        'stacktach.stacky_server.do_list_usage_launches'),
开发者ID:Priyaag,项目名称:stacktach,代码行数:31,代码来源:urls.py

示例14: Consumer

try:
    import ujson as json
except ImportError:
    try:
        import simplejson as json
    except ImportError:
        import json

from pympler.process import ProcessMemoryInfo

from stacktach import db
from stacktach import stacklog
from stacktach import views

stacklog.set_default_logger_name('worker')
LOG = stacklog.get_logger()


class Consumer(kombu.mixins.ConsumerMixin):
    def __init__(self, name, connection, deployment, durable, queue_arguments,
                 exchange, topics, queue_name_prefix):
        self.connection = connection
        self.deployment = deployment
        self.durable = durable
        self.queue_arguments = queue_arguments
        self.name = name
        self.last_time = None
        self.pmi = None
        self.processed = 0
        self.total_processed = 0
        self.topics = topics
开发者ID:RallySoftware,项目名称:stacktach,代码行数:31,代码来源:worker.py

示例15: test_get_logger_should_get_default_logger_if_exchange_not_provided

 def test_get_logger_should_get_default_logger_if_exchange_not_provided(self):
     filename = 'default_logger'
     logger = stacklog.get_logger(filename)
     self.assertIsInstance(logger, logging.Logger)
     for file in glob.glob('{0}.log*'.format(filename)):
         os.remove(file)
开发者ID:anujm,项目名称:stacktach,代码行数:6,代码来源:test_stacklog.py


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