<commit_before>import logging

formatter = logging.Formatter(fmt='[%(asctime)s %(levelname)s] %(name)s:  %(message)s')

console_handler = logging.StreamHandler()
console_handler.setLevel(logging.DEBUG)
console_handler.setFormatter(formatter)

file_handler = logging.FileHandler('iron-lady.log')
file_handler.setLevel(logging.DEBUG)
file_handler.setFormatter(formatter)


class JsonFormatter(logging.Formatter):
    def __init__(self):
        super(JsonFormatter, self).__init__()

    def format(self, record):
        import re
        import json

        d = {}
        for key_value in re.split(pattern='[ ,]', string=record.message):
            if '=' in key_value:
                key, value = key_value.split('=')
                value = value.strip()
                key = key.strip()
                if not key:
                    continue
                try:<commit_msg>erase - (dash) from json logger to get it correctly processed by elastic search (teh deafault is split by dash)<commit_after>import logging

formatter = logging.Formatter(fmt='[%(asctime)s %(levelname)s] %(name)s:  %(message)s')

console_handler = logging.StreamHandler()
console_handler.setLevel(logging.DEBUG)
console_handler.setFormatter(formatter)

file_handler = logging.FileHandler('iron-lady.log')
file_handler.setLevel(logging.DEBUG)
file_handler.setFormatter(formatter)


class JsonFormatter(logging.Formatter):
    def __init__(self):
        super(JsonFormatter, self).__init__()

    def format(self, record):
        import re
        import json

        d = {}
        for key_value in re.split(pattern='[ ,]', string=record.message):
            if '=' in key_value:
                key, value = key_value.split('=')
                value = value.strip()
                value = value.replace('-', '')
                key = key.strip()
                if not key:
                    continue
                try:
{'fraction_non_alphanumeric': 0.11866178776790381, 'fraction_numerical': 0.0, 'mean_word_length': 2.6045197740112993, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1247167', 'n_tokens_mistral': 564, 'n_tokens_neox': 532, 'n_words': 117}