<commit_before>import logging
import os
import sys


def get_logger(name, outputdir=None):
    # Creates a logger with a stream and file handler
    logger = logging.getLogger(name)
    logger.setLevel(logging.DEBUG)

    console = logging.StreamHandler(stream=sys.stdout)
    console.setLevel(logging.INFO)

    formatter = logging.Formatter(fmt='real_format: [%(levelname)s] '
                                      '[%(asctime)s:%(name)s]: %(message)s',
                                  datefmt='%m-%d %H:%M:%S')
    console.setFormatter(formatter)
    logger.addHandler(console)

    if outputdir is not None:
        logger_file = os.path.join(outputdir, '%s.log' % name)
        file_handler = logging.FileHandler(filename=logger_file, mode="w")
        file_handler.setLevel(logging.DEBUG)
        file_handler.setFormatter(formatter)
        logger.addHandler(file_handler)

    logger.debug("Logger created")

    return logger<commit_msg>Logging: configure root logger -> we get output from all modules which use logging<commit_after>import logging
import os
import sys


def get_logger(name, outputdir=None):
    # Root logger with a stream and file handler
    root = logging.getLogger()

    console = logging.StreamHandler(stream=sys.stdout)
    console.setLevel(logging.INFO)

    formatter = logging.Formatter(fmt='real_format: [%(levelname)s] '
                                      '[%(asctime)s:%(name)s]: %(message)s',
                                  datefmt='%m-%d %H:%M:%S')
    console.setFormatter(formatter)
    root.addHandler(console)

    if outputdir is not None:
        logger_file = os.path.join(outputdir, '%s.log' % name)
        file_handler = logging.FileHandler(filename=logger_file, mode="w")
        file_handler.setLevel(logging.DEBUG)
        file_handler.setFormatter(formatter)
        root.addHandler(file_handler)

    # Create a logger
    logger = logging.getLogger(name)
    logger.setLevel(logging.DEBUG)
    logger.debug("Logger created")

    return logger
{'fraction_non_alphanumeric': 0.11249377799900448, 'fraction_numerical': 0.0, 'mean_word_length': 2.9105058365758754, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2984790', 'n_tokens_mistral': 596, 'n_tokens_neox': 571, 'n_words': 119}