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-04-26 15:34:31 +0200
commit0acb8eb018afd993c363c05da8a45091abc59fd9 (patch)
treeccff00fab8777111bb731285b205c5561c0b9276
parent801ac1c76853419136324b883d95021d810ab4d1 (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>
-rw-r--r--functest/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 100644
--- 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)