class StatisticCommand(BaseCommand):
  def __init__(self):
    self.levelStatistic = Statistic()
    self.threadStatistic = Statistic()
    self.loggerStatistic = Statistic()
    self.timeStatistic = Statistic()
    self.entries = 0
    super().__init__()

  def execute(self, record):
    self.levelStatistic.addValue(record[2])
    self.threadStatistic.addValue(record[1])
    self.loggerStatistic.addValue(record[3])
    self.processTime(record)
    self.entries += 1

  def printResult(self):
    print("logfile has", self.entries, "entries\n")

    print("\nLog level\n---------")
    self.levelStatistic.printStatistic()
    print("\nThreads\n-------")
    self.threadStatistic.printStatistic()
    print("\nLogger\n------")
    self.loggerStatistic.printStatistic()
    print("\nTime\n----")
    self.timeStatistic.printStatistic()

  def processTime(self, record):
    time = record[0][0:16]
    self.timeStatistic.addValue(time)