aboutsummaryrefslogtreecommitdiffstats
path: root/utils/functest_logger.py
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-05-04 16:57:36 +0200
committerjose.lausuch <jose.lausuch@ericsson.com>2016-05-04 17:09:58 +0200
commitcd42c5ba41d08ed6d378aa78ccdabbb51569f739 (patch)
treeecf371f3b7bb51c1e596e3a1a1af6385a1a02cbb /utils/functest_logger.py
parent6790e17eb7c1a3eaaccfe97ac90932e3c15eea6d (diff)
Refactor, add logger handler to collect all the logs to a file as well
JIRA: FUNCTEST-190 Also: - remove old code that are not used any more - improve execute_command function - fix logger output for run_tempest Change-Id: Ib268738ada1b9de2a418ef01e684a90e6f4e02ed Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'utils/functest_logger.py')
-rw-r--r--utils/functest_logger.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/utils/functest_logger.py b/utils/functest_logger.py
index b9b30871..72c4b914 100644
--- a/utils/functest_logger.py
+++ b/utils/functest_logger.py
@@ -28,6 +28,8 @@ import os
class Logger:
def __init__(self, logger_name):
+ CI_DEBUG = os.getenv('CI_DEBUG')
+
self.logger = logging.getLogger(logger_name)
self.logger.setLevel(logging.DEBUG)
@@ -35,15 +37,16 @@ class Logger:
formatter = logging.Formatter('%(asctime)s - %(name)s - '
'%(levelname)s - %(message)s')
ch.setFormatter(formatter)
-
- CI_DEBUG = os.getenv('CI_DEBUG')
-
- ch.setLevel(logging.INFO)
-
if CI_DEBUG is not None and CI_DEBUG.lower() == "true":
ch.setLevel(logging.DEBUG)
-
+ else:
+ ch.setLevel(logging.INFO)
self.logger.addHandler(ch)
+ hdlr = logging.FileHandler('/home/opnfv/functest/results/functest.log')
+ hdlr.setFormatter(formatter)
+ hdlr.setLevel(logging.DEBUG)
+ self.logger.addHandler(hdlr)
+
def getLogger(self):
return self.logger