Пример #1
0
    def un_register_multiprocess_handlers(logger: logging = None) -> None:
        """
        Un register the multiprocess handler
        :param logger: logging.logger
        :return: None
        """
        if logger is None:
            logger = logging.getLogger()

        for handler in logger.handlers:
            handler.close()
            logger.removeHandler(handler)
Пример #2
0
    def un_register_multiprocess_handlers(logger: logging=None) -> None:
        """
        Un register the multiprocess handler
        :param logger: logging.logger
        :return: None
        """
        if logger is None:
            logger = logging.getLogger()

        for handler in logger.handlers:
            handler.close()
            logger.removeHandler(handler)
Пример #3
0
    def register_multiprocess_handlers(logger: logging=None)-> None:
        """
        Wraps the handlers in the given Logger with an MultiProcessingHandler.
        :param logger: whose handlers to wrap. By default, the root logger.
        :return: None
        """
        if logger is None:
            logger = logging.getLogger()

        for i, orig_handler in enumerate(list(logger.handlers)):
            handler = MultiProcessingHandler('mp-handler-{0}'.format(i), sub_handler=orig_handler)
            logger.removeHandler(orig_handler)
            logger.addHandler(handler)
Пример #4
0
    def register_multiprocess_handlers(logger: logging = None) -> None:
        """
        Wraps the handlers in the given Logger with an MultiProcessingHandler.
        :param logger: whose handlers to wrap. By default, the root logger.
        :return: None
        """
        if logger is None:
            logger = logging.getLogger()

        for i, orig_handler in enumerate(list(logger.handlers)):
            handler = MultiProcessingHandler('mp-handler-{0}'.format(i),
                                             sub_handler=orig_handler)
            logger.removeHandler(orig_handler)
            logger.addHandler(handler)