<commit_before># mux

💋 an elegant handler for python terminal logging

## Examples
<hr/>

### Let the magic begin 😎

    # import
    import logging
    from mux import MuxStreamHandler
    # setup
    logger = logging.getLogger(__name__)
    handler = MuxStreamHandler()
    handler.setLevel(logging.DEBUG)
    logger.addHandler(handler)
    logger.setLevel(logging.DEBUG)
    # use
    logger.debug("debugging for better result")
    logger.info("everything is ok, so far")
    logger.warning("you should be careful")
    logger.error("oh, you made a mistake")
    logger.critical("ctrl-c to stop...")

![screen shot 2017-01-02 at 15 01 28](https://cloud.githubusercontent.com/assets/10671733/21585496/79d28c94-d0fc-11e6-8ea5-c1efcb4d517f.png)

### Elegant exception traceback

    # import
    import logging
    from mux import MuxStreamHandler
    # setup
    logger = logging.getLogger(__name__)
    handler = MuxStreamHandler()
    handler.setLevel(logging.ERROR)
    logger.addHandler(handler)
    logger.setLevel(logging.ERROR)
    # use
    try:
        x = 1 / 0
    except ZeroDivisionError as e:
        logger.exception('ZeroDivisionError: %s', e)

![screen shot 2017-01-02 at 15 05 18](https://cloud.githubusercontent.com/assets/10671733/21585513/f168668e-d0fc-11e6-8496-049d9640b8aa.png)

## ToDo
<hr/>

+ [ ] big message text friendly
+ [x] more useful info for ERROR and CRITICAL level
+ [ ] user-defined message string highlight
<commit_msg>update readme img<commit_after># mux

💋 an elegant handler for python terminal logging

## Examples
<hr/>

### Let the magic begin 😎

    # import
    import logging
    from mux import MuxStreamHandler
    # setup
    logger = logging.getLogger(__name__)
    handler = MuxStreamHandler()
    handler.setLevel(logging.DEBUG)
    logger.addHandler(handler)
    logger.setLevel(logging.DEBUG)
    # use
    logger.debug("debugging for better result")
    logger.info("everything is ok, so far")
    logger.warning("you should be careful")
    logger.error("oh, you made a mistake")
    logger.critical("ctrl-c to stop...")

![screen shot 2017-01-02 at 15 08 25](https://cloud.githubusercontent.com/assets/10671733/21585534/68427a1a-d0fd-11e6-9ccc-53f141511c16.png)

### Elegant exception traceback

    # import
    import logging
    from mux import MuxStreamHandler
    # setup
    logger = logging.getLogger(__name__)
    handler = MuxStreamHandler()
    handler.setLevel(logging.ERROR)
    logger.addHandler(handler)
    logger.setLevel(logging.ERROR)
    # use
    try:
        x = 1 / 0
    except ZeroDivisionError as e:
        logger.exception('ZeroDivisionError: %s', e)

![screen shot 2017-01-02 at 15 08 40](https://cloud.githubusercontent.com/assets/10671733/21585535/6897c0b0-d0fd-11e6-853b-70ffec5ed723.png)

## ToDo
<hr/>

+ [ ] big message text friendly
+ [x] more useful info for ERROR and CRITICAL level
+ [ ] user-defined message string highlight

{'fraction_non_alphanumeric': 0.10868079289131921, 'fraction_numerical': 0.06937799043062201, 'mean_word_length': 3.414781297134238, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '1935299', 'n_tokens_mistral': 1082, 'n_tokens_neox': 950, 'n_words': 236}