<commit_before>import datetime
import logging
import math
import signal
import sys
import threading
import time
from contextlib import contextmanager

from colorama import Fore
from colorama import Style

log = logging.getLogger('pajbot')

COLORS = {
    'WARNING': Fore.YELLOW,
    'INFO': Fore.WHITE,
    'DEBUG': Fore.BLUE,
    'CRITICAL': Fore.YELLOW,
    'ERROR': Fore.RED
}


class ColoredFormatter(logging.Formatter):
    def __init__(self, msg):
        logging.Formatter.__init__(self, msg)

    def format(self, record):
        levelname = record.levelname
        if levelname in COLORS:
            levelname_color = Style.BRIGHT + COLORS[levelname] + levelname + Style.RESET_ALL
            record.levelname = levelname_color
        return logging.Formatter.format(self, record)


def init_logging(app='pajbot'):
    class LogFilter(logging.Filter):
        def __init__(self, level):
            self.level = level

        def filter(self, record):
            return record.levelno < self.level

    # Uncomment the line below if you want full debug messages from everything!
    # This includes all debug messages from the IRC libraries, which can be useful for debugging.
    # logging.basicConfig(level=logging.DEBUG)

    log = logging.getLogger(app)
    log.setLevel(logging.DEBUG)

    colored_formatter = ColoredFormatter('[%(asctime)s] [%(levelname)-20s] %(message)s')
    log_filter = LogFilter(logging.WARNING)

    logger_stdout = logging.StreamHandler(sys.stdout)
    logger_stdout.setFormatter(colored_formatter)
    logger_stdout.addFilter(log_filter)
    logger_stdout.setLevel(logging.DEBUG)

    logger_stderr = logging.StreamHandler(sys.stderr)
    logger_stderr.setFormatter(colored_formatter)
    logger_stderr.setLevel(logging.WARNING)

    logging.getLogger().addHandler(logger_stdout)
    logging.getLogger().addHandler(logger_stderr)

    return log<commit_msg>super debug changed from DEBUG to DEBUG-2<commit_after>import datetime
import logging
import math
import signal
import sys
import threading
import time
from contextlib import contextmanager

from colorama import Fore
from colorama import Style

log = logging.getLogger('pajbot')

COLORS = {
    'WARNING': Fore.YELLOW,
    'INFO': Fore.WHITE,
    'DEBUG': Fore.BLUE,
    'CRITICAL': Fore.YELLOW,
    'ERROR': Fore.RED
}


class ColoredFormatter(logging.Formatter):
    def __init__(self, msg):
        logging.Formatter.__init__(self, msg)

    def format(self, record):
        levelname = record.levelname
        if levelname in COLORS:
            levelname_color = Style.BRIGHT + COLORS[levelname] + levelname + Style.RESET_ALL
            record.levelname = levelname_color
        return logging.Formatter.format(self, record)


def init_logging(app='pajbot'):
    class LogFilter(logging.Filter):
        def __init__(self, level):
            self.level = level

        def filter(self, record):
            return record.levelno < self.level

    # Uncomment the line below if you want full debug messages from everything!
    # This includes all debug messages from the IRC libraries, which can be useful for debugging.
    # logging.basicConfig(level=logging.DEBUG - 2)

    log = logging.getLogger(app)
    log.setLevel(logging.DEBUG)

    colored_formatter = ColoredFormatter('[%(asctime)s] [%(levelname)-20s] %(message)s')
    log_filter = LogFilter(logging.WARNING)

    logger_stdout = logging.StreamHandler(sys.stdout)
    logger_stdout.setFormatter(colored_formatter)
    logger_stdout.addFilter(log_filter)
    logger_stdout.setLevel(logging.DEBUG)

    logger_stderr = logging.StreamHandler(sys.stderr)
    logger_stderr.setFormatter(colored_formatter)
    logger_stderr.setLevel(logging.WARNING)

    logging.getLogger().addHandler(logger_stdout)
    logging.getLogger().addHandler(logger_stderr)

    return log
{'fraction_non_alphanumeric': 0.09171443460135487, 'fraction_numerical': 0.001563314226159458, 'mean_word_length': 3.6988984088127297, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6152853', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1082, 'n_words': 266}