summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2017-04-26 15:31:19 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2017-05-15 09:18:28 +0200
commit555d7546711b67197c9daeb87e8a0415203b3b88 (patch)
treec214dc1ceab803be2c1385d389de254f78463767
parent2c48dfc2b32c577c4754c2f1df2e6becc9bf5af3 (diff)
Logger must be a singleton
It avoids creating a python object for every message printed. Change-Id: Ia42b59db9f7ce4eadc7e91da4d193db646b54d85 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 0acb8eb018afd993c363c05da8a45091abc59fd9)
-rwxr-xr-xfunctest/utils/functest_logger.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/functest/utils/functest_logger.py b/functest/utils/functest_logger.py
index 555e9c28c..ba52829f7 100755
--- a/functest/utils/functest_logger.py
+++ b/functest/utils/functest_logger.py
@@ -41,6 +41,13 @@ ignore = ["paramiko",
class Logger(object):
+ instance = None
+
+ def __new__(cls, logger_name):
+ if cls.instance is None:
+ cls.instance = object.__new__(cls)
+ return cls.instance
+
def __init__(self, logger_name):
self.setup_logging()
self.logger = logging.getLogger(logger_name)