<commit_before>"""
log module
"""
import sys
import logging
import logbook

from scilifelab.utils import config as cf
from logbook.queues import RedisHandler

try:
    import bcbio.pipeline.config_utils as cl
except ImportError:
    import bcbio.pipeline.config_loader as cl

def minimal_logger(namespace, extra_fields=None, debug=False):
    """Make and return a minimal console logger.

    NOTE: this does apparently *not* work with logbook as I first thought, and
    log handlers will *not* take care of output. If something is to be
    logged to a file in a module, the logger has to be implemented for
    that particular purpose.

    The current function is copied from cement.core.backend.

    :param namespace: namspace of logger
    """
    config = cf.load_config()
    log = logbook.Logger(namespace, level=logbook.INFO)
    s_h = logbook.StreamHandler(sys.stdout, level = logbook.INFO, bubble=True)
    log.handlers.append(s_h)
    try:
        host = config.get('log', 'redis_host')
        port = config.getint('log', 'redis_port')
        key = config.get('log', 'redis_key')
        password = config.get('log', 'redis_password')
        if not extra_fields:
            extra_fields = {"program": "pm",
                            "command": namespace}
        r_h = RedisHandler(host=host, port=port, key=key, password=password,
                extra_fields=extra_fields, level=logbook.INFO, bubble=True)
        log.handlers.append(r_h)
    except:
        log.warn('Not loading RedisHandler')
        pass<commit_msg>made redishandler warning message a debug-level message<commit_after>"""
log module
"""
import sys
import logging
import logbook

from scilifelab.utils import config as cf
from logbook.queues import RedisHandler

try:
    import bcbio.pipeline.config_utils as cl
except ImportError:
    import bcbio.pipeline.config_loader as cl

def minimal_logger(namespace, extra_fields=None, debug=False):
    """Make and return a minimal console logger.

    NOTE: this does apparently *not* work with logbook as I first thought, and
    log handlers will *not* take care of output. If something is to be
    logged to a file in a module, the logger has to be implemented for
    that particular purpose.

    The current function is copied from cement.core.backend.

    :param namespace: namspace of logger
    """
    config = cf.load_config()
    log = logbook.Logger(namespace, level=logbook.INFO)
    s_h = logbook.StreamHandler(sys.stdout, level = logbook.INFO, bubble=True)
    log.handlers.append(s_h)
    try:
        host = config.get('log', 'redis_host')
        port = config.getint('log', 'redis_port')
        key = config.get('log', 'redis_key')
        password = <PASSWORD>.get('log', 'redis_password')
        if not extra_fields:
            extra_fields = {"program": "pm",
                            "command": namespace}
        r_h = RedisHandler(host=host, port=port, key=key, password=password,
                extra_fields=extra_fields, level=logbook.INFO, bubble=True)
        log.handlers.append(r_h)
    except:
        log.debug('Not loading RedisHandler')
        pass
{'fraction_non_alphanumeric': 0.0948578728840626, 'fraction_numerical': 0.0, 'mean_word_length': 3.088772845953003, 'pattern_counts': {'":': 4, '<': 4, '<?xml version=': 0, '>': 4, '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': '7190461', 'n_tokens_mistral': 920, 'n_tokens_neox': 915, 'n_words': 289}