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)
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)
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)
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)