"""
Collector service provides methods for collection of test runtime results results and storing results

2017 - samuels(c)
"""
import time

from logger import server_logger


class Collector:
    def __init__(self, test_stats, stop_event):
        self.logger = server_logger.StatsLogger('__Collector__').logger
        self.test_stats = test_stats
        self.stop_event = stop_event

    def run(self):
        time.sleep(10)
        while not self.stop_event.is_set():
            self.logger.info("{0:^80}".format("#### Test Runtime Stats ####"))
            self.logger.info("{0:>40}".format("Total file operations executed {0}".format(self.test_stats['total'])))
            self.logger.info("{0:>40}".format("Total file operations succeeded {0}"
                                              .format(self.test_stats['success']['total'])))
            self.logger.info("{0:>40}".format("Total file operations failed {0}"
                                              .format(self.test_stats['failed']['total'])))
            self.logger.info("{0:^80}".format("=== Successful operations stats ==="))
            for k, v in self.test_stats['success'].items():
                self.logger.info("{0}".format("{0}: {1}".format(k, v)).rjust(40))
            self.logger.info("{0:^80}".format("=== Failed operations stats ==="))
            for k, v in self.test_stats['failed'].items():
                self.logger.info("{0}".format("{0}: {1}".format(k, v)).rjust(40))
            time.sleep(10)


@@ -492,36 +492,32 @@
 .logger.info(%22%7B0
-:%5E80
 %7D%22.format(%22#### 
@@ -567,36 +567,32 @@
 .logger.info(%22%7B0
-:%3E40
 %7D%22.format(%22Total
@@ -681,36 +681,32 @@
 .logger.info(%22%7B0
-:%3E40
 %7D%22.format(%22Total
@@ -771,36 +771,32 @@
                 
-  
-  
 .format(self.tes
@@ -862,12 +862,8 @@
 (%22%7B0
-:%3E40
 %7D%22.f
@@ -937,36 +937,32 @@
                 
- 
-   
 .format(self.tes
@@ -1015,36 +1015,32 @@
 .logger.info(%22%7B0
-:%5E80
 %7D%22.format(%22=== S
@@ -1251,12 +1251,8 @@
 (%22%7B0
-:%5E80
 %7D%22.f
@@ -1426,32 +1426,32 @@
  v)).rjust(40))%0A
+
             time
@@ -1461,9 +1461,8 @@
 eep(10)%0A
-%0A

Test statistics print formatting