<commit_before><commit_msg>Make a module for logging config<commit_after>'''
Module containing default logging settings for gregbot.
'''
import logging.config


DEFAULT_LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'default': {
            'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
        }
    },
    'handlers': {
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'default',
        },
        'file': {
            'level': 'ERROR',
            'class': 'logging.handlers.RotatingFileHandler',
            'filename': 'log/error.log',
            'backupCount': 5,
            'maxBytes': 1048576,
            'encoding': 'utf-8',
            'formatter': 'default',
        },
    },
    'root': {
        'handlers': ['console', 'file'],
        'level': 'DEBUG',
    },
}


def configure_logging():
    """Load the default config and rollover any rotating file handlers.

    """
    logging.config.dictConfig(DEFAULT_LOGGING)

    for handler in logging.getLogger().handlers:
        if isinstance(handler, logging.handlers.RotatingFileHandler):
            handler.doRollover()
{'fraction_non_alphanumeric': 0.15178571428571427, 'fraction_numerical': 0.008116883116883116, 'mean_word_length': 2.194300518134715, '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': '5672574', 'n_tokens_mistral': 372, 'n_tokens_neox': 357, 'n_words': 77}