<commit_before>
"""
Logging used in debug mode
"""

import sys


class Logger:
    """
    Logs data in debug mode
    """
    VERBOSITY_LEVELS = ["none", "error", "warning", "info", "debug"]
    accepted_verbosity_levels = []
    log_file = None

    @staticmethod
    def open(verbosity_level="error", filename=None):

        if verbosity_level not in Logger.VERBOSITY_LEVELS:
            sys.stderr.write("warning: Unaccepted verbosity level. Defaulting to 'info'\n")
            index = Logger.VERBOSITY_LEVELS.index("info")
        else:
            index = Logger.VERBOSITY_LEVELS.index(verbosity_level)

        Logger.accepted_verbosity_levels = Logger.VERBOSITY_LEVELS[: index + 1]

        if filename:
            Logger.log_file = open(filename, "w")
        else:
            # write to stdout
            Logger.log_file = sys.stdout

    @staticmethod
    def log(message: str, verbosity_level="info"):
        if verbosity_level in Logger.accepted_verbosity_levels:
            if verbosity_level is not "info":
                Logger.log_file.write("(" + verbosity_level + "): ")
            Logger.log_file.write(message)

    @staticmethod
    def close():
        if Logger.log_file is not sys.stdout:<commit_msg>log based on process id<commit_after>
"""
Logging used in debug mode
"""

import sys
import os


class Logger:
    """
    Logs data in debug mode
    """
    VERBOSITY_LEVELS = ["none", "error", "warning", "info", "debug"]
    accepted_verbosity_levels = []
    log_file = None

    @staticmethod
    def open(verbosity_level="error", filename=None):

        if verbosity_level not in Logger.VERBOSITY_LEVELS:
            sys.stderr.write("warning: Unaccepted verbosity level. Defaulting to 'info'\n")
            index = Logger.VERBOSITY_LEVELS.index("info")
        else:
            index = Logger.VERBOSITY_LEVELS.index(verbosity_level)

        Logger.accepted_verbosity_levels = Logger.VERBOSITY_LEVELS[: index + 1]

        if filename:
            Logger.log_file = open(filename, "w")
        else:
            # write to stdout
            Logger.log_file = sys.stdout

    @staticmethod
    def log(message: str, verbosity_level="info"):
        if verbosity_level in Logger.accepted_verbosity_levels:
            if verbosity_level is not "info":
                Logger.log_file.write("(" + verbosity_level + ") ")
            Logger.log_file.write("[" + str(os.getpid()) + "]: ")
            Logger.log_file.write(message)

    @staticmethod
    def close():
        if Logger.log_file is not sys.stdout:
{'fraction_non_alphanumeric': 0.10849980415197806, 'fraction_numerical': 0.0007833920877399138, 'mean_word_length': 2.517906336088154, 'pattern_counts': {'":': 2, '<': 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': '2681410', 'n_tokens_mistral': 788, 'n_tokens_neox': 767, 'n_words': 177}