當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。