<commit_before>import eliot
import logging
import sys
from eliot.stdlib import EliotHandler

logging.getLogger().addHandler(EliotHandler())
logging.getLogger().setLevel(logging.DEBUG)
eliot.to_file(sys.stdout)
logging.captureWarnings(True)

logg = logging.getLogger(__name__)

logging.getLogger("parso").setLevel(logging.WARN)

logg.info("init")<commit_msg>use repr for log serialization if json fails<commit_after>import eliot
import logging
import sys
from eliot.stdlib import EliotHandler
from eliot.json import EliotJSONEncoder

class MyEncoder(EliotJSONEncoder):
    def default(self, obj):

        try:
            return EliotJSONEncoder.default(self, obj)
        except TypeError:
            return repr(obj)


logging.getLogger().addHandler(EliotHandler())
logging.getLogger().setLevel(logging.DEBUG)

eliot.to_file(sys.stdout, encoder=MyEncoder)

logging.captureWarnings(True)

logg = logging.getLogger(__name__)

logging.getLogger("parso").setLevel(logging.WARN)
{'fraction_non_alphanumeric': 0.10348360655737705, 'fraction_numerical': 0.0, 'mean_word_length': 5.691780821917808, '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': '645258', 'n_tokens_mistral': 303, 'n_tokens_neox': 293, 'n_words': 59}