<commit_before>from __future__ import print_function

import logging
import logging.config
import os
import sys
import os.path

import pkg_resources

'''
Module that manages the global logging
'''


class SetupLogger(object):
    '''
    Called at the beginning of run.py or sasview.py
    '''

    def __init__(self, logger_name):
        self._find_config_file()
        self.name = logger_name

    def config_production(self):
        logger = logging.getLogger(self.name)
        if not logger.root.handlers:
            self._read_config_file()
            logging.captureWarnings(True)
            logger = logging.getLogger(self.name)
        logging.getLogger('matplotlib').setLevel(logging.WARN)
        return logger

    def config_development(self):
        '''
        '''
        self._read_config_file()
        logger = logging.getLogger(self.name)
        self._update_all_logs_to_debug(logger)
        logging.captureWarnings(True)
        self._disable_debug_from_config()
        logging.getLogger('matplotlib').setLevel(logging.WARN)
        return logger

    def _disable_debug_from_config(self):
        '''disable DEBUG logs as per user configuration (DEBUG logs disabled by default)'''
        if config.FILTER_DEBUG_LOGS:
            logging.disable(logging.DEBUG)<commit_msg>Removed config entries from logger<commit_after>from __future__ import print_function

import logging
import logging.config
import os
import sys
import os.path

import pkg_resources

'''
Module that manages the global logging
'''


class SetupLogger(object):
    '''
    Called at the beginning of run.py or sasview.py
    '''

    def __init__(self, logger_name):
        self._find_config_file()
        self.name = logger_name

    def config_production(self):
        logger = logging.getLogger(self.name)
        if not logger.root.handlers:
            self._read_config_file()
            logging.captureWarnings(True)
            logger = logging.getLogger(self.name)
        logging.getLogger('matplotlib').setLevel(logging.WARN)
        return logger

    def config_development(self):
        '''
        '''
        self._read_config_file()
        logger = logging.getLogger(self.name)
        self._update_all_logs_to_debug(logger)
        logging.captureWarnings(True)
        logging.getLogger('matplotlib').setLevel(logging.WARN)
        return logger
{'fraction_non_alphanumeric': 0.08768971332209106, 'fraction_numerical': 0.0, 'mean_word_length': 2.82741935483871, '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': '315910', 'n_tokens_mistral': 663, 'n_tokens_neox': 650, 'n_words': 145}