<commit_before>import traceback

class LoggingMiddleware(object):
    def process_job(self, job):
        print "I: Running job %s" % job

    def process_result(self, job, result, duration):
        print "I: Finished job %s => %r (Time taken: %.2fs)" % (
            job,
            result,
            duration,
        )

    def process_exception(self, job, time_taken, *exc_info):
        traceback.print_exception(*exc_info)<commit_msg>Use logging framework.<commit_after>from __future__ import absolute_import

import logging

class LoggingMiddleware(object):
    def process_job(self, job):
        logging.info("Running job %s", job)

    def process_result(self, job, result, duration):
        logging.info("Finished job %s => %r (Time taken: %.2fs)",
            job,
            result,
            duration,
        )

    def process_exception(self, job, duration, *exc_info):
        logging.error("Exception when processing %r (duration: %.2fs): %s",
            job,
            duration,
            traceback.format_exception(*exc_info),
        )
{'fraction_non_alphanumeric': 0.11225444340505145, 'fraction_numerical': 0.002806361085126286, 'mean_word_length': 2.4516129032258065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4221081', 'n_tokens_mistral': 307, 'n_tokens_neox': 302, 'n_words': 82}