<commit_before>"""
log module for eventmq
"""
import logging

import zmq
import zmq.log.handlers


FORMAT_STANDARD = logging.Formatter(
    '%(asctime)s - %(name)s  %(levelname)s - "%(message)s')


class PUBHandler(zmq.log.handlers.PUBHandler):
    """
    """
    pass


class handlers(object):
    """
    log handlers

    PUBLISH_HANDLER - blast logs through a pub mechanism
    STREAM_LOGGER - logs to stdout/stderr
    """
    PUBLISH_HANDLER = PUBHandler
    STREAM_HANDLER = logging.StreamHandler


def get_logger(name, formatter=FORMAT_STANDARD,
               handler=handlers.PUBLISH_HANDLER):
    logger = logging.getLogger(name)
    logger.setLevel(logging.DEBUG)

    if handler == handlers.PUBLISH_HANDLER:
        _handler_sock = zmq.Context.instance().socket(zmq.PUB)
        _handler_sock.bind('tcp://127.0.0.1:33445')

        import time
        time.sleep(1)

        handler = handler(_handler_sock)
        handler.root_topic = name
    else:
        handler = handler()

    handler.setFormatter(formatter)

    logger.addHandler(handler)

    return logger<commit_msg>need to singleton up the logger or something<commit_after>"""
log module for eventmq
"""
import logging

import zmq
import zmq.log.handlers


FORMAT_STANDARD = logging.Formatter(
    '%(asctime)s - %(name)s  %(levelname)s - "%(message)s')


class PUBHandler(zmq.log.handlers.PUBHandler):
    """
    """
    pass


class handlers(object):
    """
    log handlers

    PUBLISH_HANDLER - blast logs through a pub mechanism
    STREAM_LOGGER - logs to stdout/stderr
    """
    PUBLISH_HANDLER = PUBHandler
    STREAM_HANDLER = logging.StreamHandler


def get_logger(name, formatter=FORMAT_STANDARD,
               handler=handlers.STREAM_HANDLER):
    logger = logging.getLogger(name)
    logger.setLevel(logging.DEBUG)

    if handler == handlers.PUBLISH_HANDLER:
        _handler_sock = zmq.Context.instance().socket(zmq.PUB)
        _handler_sock.bind('tcp://127.0.0.1:33445')

        import time
        time.sleep(1)

        handler = handler(_handler_sock)
        handler.root_topic = name
    else:
        handler = handler()

    handler.setFormatter(formatter)

    logger.addHandler(handler)

    return logger
{'fraction_non_alphanumeric': 0.10649819494584838, 'fraction_numerical': 0.010830324909747292, 'mean_word_length': 2.987410071942446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4448348', 'n_tokens_mistral': 760, 'n_tokens_neox': 696, 'n_words': 138}