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


Python logging.Manager方法代码示例

本文整理汇总了Python中logging.Manager方法的典型用法代码示例。如果您正苦于以下问题:Python logging.Manager方法的具体用法?Python logging.Manager怎么用?Python logging.Manager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在logging的用法示例。


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

示例1: resetLogging

# 需要导入模块: import logging [as 别名]
# 或者: from logging import Manager [as 别名]
def resetLogging():
    """ Reset the handlers and loggers so that we
    can rerun the tests starting from a blank slate.
    """
    __pragma__("skip")
    logging._handlerList = []

    import weakref
    logging._handlers = weakref.WeakValueDictionary()

    logging.root = logging.RootLogger(logging.WARNING)
    logging.Logger.root = logging.root
    logging.Logger.manager = logging.Manager(logging.root)
    logging.root.manager = logging.Logger.manager
    __pragma__("noskip")

    if __envir__.executor_name == __envir__.transpiler_name:
        logging._resetLogging() 
开发者ID:QQuick,项目名称:Transcrypt,代码行数:20,代码来源:utils.py

示例2: h_LoggerConnected

# 需要导入模块: import logging [as 别名]
# 或者: from logging import Manager [as 别名]
def h_LoggerConnected(self, envelope):
        self.asLogger = envelope.sender
        # Dirty trick here to completely re-initialize logging in this
        # process... something the standard Python logging interface does
        # not allow via the API.
        self.oldLoggerRoot = logging.root
        logging.root = ThespianLogForwarder(self.asLogger, self.transport)
        logging.Logger.root = logging.root
        logging.Logger.manager = logging.Manager(logging.Logger.root)
        # logging.getLogger('Thespian.Admin') \
        #        .info('ActorSystem Administrator startup @ %s', self.myAddress)

        # Now that logging is started, Admin startup can be confirmed
        self.transport.scheduleTransmit(None,
                                        TransmitIntent(self.addrOfStarter, EndpointConnected(0))
                                        .addCallback(onFailure=actorStartupFailed))

        self._activate()
        return True 
开发者ID:thespianpy,项目名称:Thespian,代码行数:21,代码来源:multiprocCommon.py

示例3: test_manager_loggerclass

# 需要导入模块: import logging [as 别名]
# 或者: from logging import Manager [as 别名]
def test_manager_loggerclass(self):
        logged = []

        class MyLogger(logging.Logger):
            def _log(self, level, msg, args, exc_info=None, extra=None):
                logged.append(msg)

        man = logging.Manager(None)
        self.assertRaises(TypeError, man.setLoggerClass, int)
        man.setLoggerClass(MyLogger)
        logger = man.getLogger('test')
        logger.warning('should appear in logged')
        logging.warning('should not appear in logged')

        self.assertEqual(logged, ['should appear in logged']) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:17,代码来源:test_logging.py

示例4: __init__

# 需要导入模块: import logging [as 别名]
# 或者: from logging import Manager [as 别名]
def __init__(self, level):
        super().__init__(level)
        self.propagate = False
        _RootLogger.manager = logging.Manager(self) 
开发者ID:theislab,项目名称:scanpy,代码行数:6,代码来源:logging.py

示例5: test_set_log_record_factory

# 需要导入模块: import logging [as 别名]
# 或者: from logging import Manager [as 别名]
def test_set_log_record_factory(self):
        man = logging.Manager(None)
        expected = object()
        man.setLogRecordFactory(expected)
        self.assertEqual(man.logRecordFactory, expected) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:7,代码来源:test_logging.py

示例6: logging_sandbox

# 需要导入模块: import logging [as 别名]
# 或者: from logging import Manager [as 别名]
def logging_sandbox():
    # Monkeypatch a replacement root logger, so that our changes to logging
    # configuration don't persist outside of the test
    root_logger = logging.RootLogger(logging.WARNING)

    with mock.patch.object(logging, "root", root_logger):
        with mock.patch.object(logging.Logger, "root", root_logger):
            with mock.patch.object(
                logging.Logger, "manager", logging.Manager(root_logger)
            ):
                yield 
开发者ID:canonical,项目名称:ubuntu-advantage-client,代码行数:13,代码来源:conftest.py

示例7: _reset_logging

# 需要导入模块: import logging [as 别名]
# 或者: from logging import Manager [as 别名]
def _reset_logging(self):
        if hasattr(self, 'oldLoggerRoot'):
            logging.root = self.oldLoggerRoot
            logging.Logger.root = self.oldLoggerRoot
            logging.Logger.manager = logging.Manager(logging.Logger.root)
            delattr(self, 'oldLoggerRoot') 
开发者ID:thespianpy,项目名称:Thespian,代码行数:8,代码来源:multiprocCommon.py


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