aboutsummaryrefslogtreecommitdiffstats
path: root/test/log.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/log.py')
-rw-r--r--test/log.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/log.py b/test/log.py
index 1e541d38352..aff182e086e 100644
--- a/test/log.py
+++ b/test/log.py
@@ -38,8 +38,9 @@ else:
log_level = 40
handler = logging.StreamHandler(sys.stdout)
-handler.setFormatter(ColorFormatter(fmt='%(asctime)s,%(msecs)03d %(message)s',
- datefmt="%H:%M:%S"))
+color_formatter = ColorFormatter(fmt='%(asctime)s,%(msecs)03d %(message)s',
+ datefmt="%H:%M:%S")
+handler.setFormatter(color_formatter)
handler.setLevel(log_level)
global_logger = logging.getLogger()
@@ -54,6 +55,16 @@ def getLogger(name):
logger.setLevel(logging.DEBUG)
return logger
+
+def get_parallel_logger(stream):
+ logger = logging.getLogger('parallel_logger_{}'.format(stream))
+ logger.propagate = False
+ 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