Commit 991dd05d authored by Arnaud Fontaine's avatar Arnaud Fontaine

Cosmetic

parent 5fd95ced
...@@ -121,7 +121,7 @@ class BenchmarkProcess(multiprocessing.Process): ...@@ -121,7 +121,7 @@ class BenchmarkProcess(multiprocessing.Process):
self._nb_users, self._nb_users,
self._user_index) self._user_index)
self._logger = result_instance.getLogger() self._logger = result_instance.logger
# Ensure the data are flushed before exiting, handled by Result class # Ensure the data are flushed before exiting, handled by Result class
# __exit__ block # __exit__ block
......
...@@ -100,7 +100,8 @@ class BenchmarkResult(object): ...@@ -100,7 +100,8 @@ class BenchmarkResult(object):
self.label_list = [] self.label_list = []
self._logger = None self._logger = None
def getLogger(self): @property
def logger(self):
if not self._logger: if not self._logger:
logging.basicConfig(stream=self.log_file, level=self._log_level) logging.basicConfig(stream=self.log_file, level=self._log_level)
self._logger = logging.getLogger('erp5.util.benchmark') self._logger = logging.getLogger('erp5.util.benchmark')
...@@ -131,7 +132,7 @@ class BenchmarkResult(object): ...@@ -131,7 +132,7 @@ class BenchmarkResult(object):
if self._first_iteration: if self._first_iteration:
self.label_list = self.getLabelList() self.label_list = self.getLabelList()
self.getLogger().debug("RESULTS: %s" % self.result_list) self.logger.debug("RESULTS: %s" % self.result_list)
self.result_list = [] self.result_list = []
self._first_iteration = False self._first_iteration = False
self._suite_idx = 0 self._suite_idx = 0
...@@ -219,7 +220,7 @@ class CSVBenchmarkResult(BenchmarkResult): ...@@ -219,7 +220,7 @@ class CSVBenchmarkResult(BenchmarkResult):
if exc_type and not issubclass(exc_type, StopIteration): if exc_type and not issubclass(exc_type, StopIteration):
msg = "An error occured, see: %s" % self._log_filename_path msg = "An error occured, see: %s" % self._log_filename_path
self.getLogger().error("%s: %s" % (exc_type, exc_value)) self.logger.error("%s: %s" % (exc_type, exc_value))
raise RuntimeError(msg) raise RuntimeError(msg)
from cStringIO import StringIO from cStringIO import StringIO
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment