From 4a0b5f9d0e0266c8c67b5faa76599fc78a247437 Mon Sep 17 00:00:00 2001 From: shwetha Date: Tue, 6 Mar 2012 16:14:34 +0530 Subject: Adding libraries to suffix timestamps to the summarylog and detaillog files Change-Id: I853981b0de99372509649360a67e8c4cca24b415 Signed-off-by: shwetha --- libs/globals/atfglobals.py | 33 +++++++++------------------------ libs/utils/atfutils.py | 8 ++++++++ 2 files changed, 17 insertions(+), 24 deletions(-) (limited to 'libs') diff --git a/libs/globals/atfglobals.py b/libs/globals/atfglobals.py index f1e6946..3e7ca38 100644 --- a/libs/globals/atfglobals.py +++ b/libs/globals/atfglobals.py @@ -7,7 +7,7 @@ AtfGlobals class wrapps all global objects used in the framework *) ConnectionsManager GlobalObj is 'The Instance' of AtfGlobals which will be referred throughout -the framework utilities. +the framework utilities. """ import testruninfo @@ -21,6 +21,7 @@ class AtfGlobals: self._logger = None self._env = None self._connectionsmanager = None + self.testrunid = None self.logname = "ATFLOG" self.atfdir = None self.testruninfo_file = None @@ -28,6 +29,7 @@ class AtfGlobals: self.summarylog_level = 'INFO' self.detaillog_file = "detaillog.out" self.detaillog_level = 'DEBUG' + self.attach_timestamp = 'yes' self.stdoutlog_dolog = 'yes' self.stdoutlog_level = 'INFO' self.testunits_maindir = "TestUnits" @@ -37,22 +39,22 @@ class AtfGlobals: self.glusterd_dir = "/etc/glusterd/*" self.glusterd_log_paths = ["/var/log/glusterfs/*.log", "/var/log/glusterfs/bricks/*"] - - + + def initLoggerObj(self): """Instantiation of Logger Object """ self._logger = logger.Log(self.logname) - + def getLoggerObj(self): """Returns Logger Object """ return self._logger - + def initConnectionsManagerObj(self): """Instantiation of ConnectionsManager Object """ - self._connectionsmanager = manager.ConnectionsManager() + self._connectionsmanager = manager.ConnectionsManager() def getConnectionsManagerObj(self): """Returns ConnectionsManager Object @@ -68,7 +70,7 @@ class AtfGlobals: """Returns TestrunInfo Object """ return self._testruninfo - + def initTestenvObj(self): """Instantiation of Testenv Object """ @@ -81,20 +83,3 @@ class AtfGlobals: GlobalObj = AtfGlobals() __all__ = ['GlobalObj'] - - - - - - - - - - - - - - - - - diff --git a/libs/utils/atfutils.py b/libs/utils/atfutils.py index b6f5174..b5fa16d 100644 --- a/libs/utils/atfutils.py +++ b/libs/utils/atfutils.py @@ -7,6 +7,7 @@ *) set_active_volume """ import re +import time import inspect from atfglobals import GlobalObj @@ -178,3 +179,10 @@ def get_active_volume(): if active_volume is None: logger.error("Active Volume not set in the TestEnvironment") return active_volume + +def attach_timestamp(filename): + """ + """ + timestamp = time.strftime("%Y_%m_%d_%H_%M_%S") + new_filename = '.'.join([filename, timestamp]) + return new_filename -- cgit