# Path: dividebatur/common.py
# def make_logger(name: str) -> logging.Logger:


import datetime
import json
import abc
import os
from .common import logger
    def json_log(self, candidate_aggregates):
        if self.test_log_dir is None:
            return
        log = []
        for candidate_id in self.candidate_ids_display(candidate_aggregates):
            log.append((self.get_candidate_title(candidate_id), candidate_aggregates.get_vote_count(candidate_id)))
        with open(os.path.join(self.test_log_dir, 'round_%d.json' % (self.current_round)), 'w') as fd:
            json.dump(log, fd)

    def write_json(self):
        params = {
            'total_papers': self.total_papers,
            'quota': self.quota,
            'vacancies': self.vacancies,
            'started': self._start_time.strftime("%Y-%m-%d %H:%M"),
            'finished': self._end_time.strftime("%Y-%m-%d %H:%M")
        }
        params.update(self.template_variables)
        obj = {
            'candidates': self.candidate_json(),
            'parties': self.party_json(),
            'parameters': params,
            'rounds': self.rounds,
            'summary': self.summary(),
        }
        with open(self.filename, 'w') as fd:
            try:
                json.dump(obj, fd)
            except TypeError:
                logger.error("failed to serialise data")

# Path: dividebatur/common.py
# def make_logger(name: str) -> logging.Logger:


# Path: dividebatur/results.py
import datetime
import json
import abc
import os
from .common import logger

    def json_log(self, candidate_aggregates):
        if self.test_log_dir is None:
            return
        log = []
        for candidate_id in self.candidate_ids_display(candidate_aggregates):
            log.append((self.get_candidate_title(candidate_id), candidate_aggregates.get_vote_count(candidate_id)))
        with open(os.path.join(self.test_log_dir, 'round_%d.json' % (self.current_round)), 'w') as fd:
            json.dump(log, fd)

    def write_json(self):
        params = {
            'total_papers': self.total_papers,
            'quota': self.quota,
            'vacancies': self.vacancies,
            'started': self._start_time.strftime("%Y-%m-%d %H:%M"),
            'finished': self._end_time.strftime("%Y-%m-%d %H:%M")
        }
        params.update(self.template_variables)
        obj = {
            'candidates': self.candidate_json(),
            'parties': self.party_json(),
            'parameters': params,
            'rounds': self.rounds,
            'summary': self.summary(),
        }
        with open(self.filename, 'w') as fd:
            try:
                json.dump(obj, fd)
            except TypeError:
                logger.error("failed to serialise data")

                logger.error("%s" % (repr(obj)))