From 991dd05d9d165caf47f63481128a8213c7fa3be3 Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine <arnaud.fontaine@nexedi.com> Date: Thu, 1 Sep 2011 14:29:53 +0900 Subject: [PATCH] Cosmetic --- erp5/util/benchmark/process.py | 2 +- erp5/util/benchmark/result.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/erp5/util/benchmark/process.py b/erp5/util/benchmark/process.py index 2df357872c..caff648f12 100644 --- a/erp5/util/benchmark/process.py +++ b/erp5/util/benchmark/process.py @@ -121,7 +121,7 @@ class BenchmarkProcess(multiprocessing.Process): self._nb_users, self._user_index) - self._logger = result_instance.getLogger() + self._logger = result_instance.logger # Ensure the data are flushed before exiting, handled by Result class # __exit__ block diff --git a/erp5/util/benchmark/result.py b/erp5/util/benchmark/result.py index 94f44d4392..bb20ffd4af 100644 --- a/erp5/util/benchmark/result.py +++ b/erp5/util/benchmark/result.py @@ -100,7 +100,8 @@ class BenchmarkResult(object): self.label_list = [] self._logger = None - def getLogger(self): + @property + def logger(self): if not self._logger: logging.basicConfig(stream=self.log_file, level=self._log_level) self._logger = logging.getLogger('erp5.util.benchmark') @@ -131,7 +132,7 @@ class BenchmarkResult(object): if self._first_iteration: 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._first_iteration = False self._suite_idx = 0 @@ -219,7 +220,7 @@ class CSVBenchmarkResult(BenchmarkResult): if exc_type and not issubclass(exc_type, StopIteration): 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) from cStringIO import StringIO -- 2.30.9