/span>('parallel_logger_{!s}'.format(stream)) logger.propagate = False logger.setLevel(logging.DEBUG) handler = logging.StreamHandler(stream) handler.setFormatter(color_formatter) handler.setLevel(log_level) logger.addHandler(handler) return logger # Static variables to store color formatting strings. # # These variables (RED, GREEN, YELLOW and LPURPLE) are used to configure # the color of the text to be printed in the terminal. Variable COLOR_RESET # is used to revert the text color to the default one. if hasattr(sys.stdout, 'isatty') and sys.stdout.isatty(): RED = '\033[91m' GREEN = '\033[92m' YELLOW = '\033[93m' LPURPLE = '\033[94m' COLOR_RESET = '\033[0m' else: RED = '' GREEN = '' YELLOW = '' LPURPLE = '' COLOR_RESET = ''