<commit_before># Copyright (c) 2015 SUSE Linux GmbH.  All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging
import re
import sys


class LoggerSchedulerFilter(logging.Filter):
    def filter(self, record):
        # messages from apscheduler scheduler instances are filtered out
        # they conflict with console progress information
        return not record.name == 'apscheduler.scheduler'


class InfoFilter(logging.Filter):
    def filter(self, record):
        # only messages with record level INFO and DEBUG can pass
        # for messages with another level an extra handler is used
        return record.levelno in (logging.INFO, logging.DEBUG)


class Logger(logging.Logger):
    """
        azurectl logging facility based on python logging
    """
    def __init__(self, name):
        logging.Logger.__init__(self, name, logging.INFO)

        formatter = logging.Formatter('%(levelname)s: %(message)s')

        # log INFO and DEBUG messages to stdout
        console_info = logging.StreamHandler(sys.__stdout__)
        console_info.setLevel(logging.INFO)
        console_info.setFormatter(formatter)
        console_info.addFilter(InfoFilter())
        console_info.addFilter(LoggerSchedulerFilter())

        # log ERROR messages to stderr (default stream)
        console_error = logging.StreamHandler()
        console_error.setLevel(logging.ERROR)<commit_msg>Make sure warning messages are logged on stdout<commit_after># Copyright (c) 2015 SUSE Linux GmbH.  All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging
import re
import sys


class LoggerSchedulerFilter(logging.Filter):
    def filter(self, record):
        # messages from apscheduler scheduler instances are filtered out
        # they conflict with console progress information
        return not record.name == 'apscheduler.scheduler'


class InfoFilter(logging.Filter):
    def filter(self, record):
        # only messages with record level INFO, WARNING and DEBUG can pass
        # for messages with another level an extra handler is used
        return record.levelno in (
            logging.INFO, logging.WARNING, logging.DEBUG
        )


class Logger(logging.Logger):
    """
        azurectl logging facility based on python logging
    """
    def __init__(self, name):
        logging.Logger.__init__(self, name, logging.INFO)

        formatter = logging.Formatter('%(levelname)s: %(message)s')

        # log INFO and DEBUG messages to stdout
        console_info = logging.StreamHandler(sys.__stdout__)
        console_info.setLevel(logging.INFO)
        console_info.setFormatter(formatter)
        console_info.addFilter(InfoFilter())
        console_info.addFilter(LoggerSchedulerFilter())

        # log ERROR messages to stderr (default stream)
        console_error = logging.StreamHandler()
        console_error.setLevel(logging.ERROR)
{'fraction_non_alphanumeric': 0.07465366854797333, 'fraction_numerical': 0.004104669061056952, 'mean_word_length': 3.4357224118316267, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4580928', 'n_tokens_mistral': 992, 'n_tokens_neox': 960, 'n_words': 384}