# Path: peanut/utils.py
# def to_s(value):
#     return str(value)
# 
# def to_u(value):
#     return str(value)


import six
import logging
from functools import partial
from peanut.utils import to_s, to_u

def pretty(func, prefix=None, fg=None, bg=None, attr=None):
    def wrapper(msg, *args, **kwargs):
        log = to_s(msg % args)
        _prefix = kwargs.get('prefix', prefix)
        if _prefix:
            log = to_s(_prefix) + log
        _fg = kwargs.get('fg', fg)
        _bg = kwargs.get('bg', bg)
        _attr = kwargs.get('attr', fg)
        log = color(to_s(log), _fg, _bg, _attr)
        func(log)
    return wrapper

# logging.VISIABLE
setattr(logging, 'VISIABLE', logging.INFO-1)

visiable = partial(logging.log, logging.VISIABLE)
logging.debug = pretty(logging.debug, prefix='☞  ')
logging.visiable = pretty(visiable, prefix='➔  ')
logging.info = pretty(logging.info, prefix='👉  ')
logging.warning = pretty(logging.warning, prefix='🌩  ', fg='yellow')
logging.error = pretty(logging.error, prefix='💥  ', fg='red')
logging.critical = pretty(logging.critical, prefix='💀  ',
        fg='red', attr='blod')


if __name__ == '__main__':
    init_logger(logging.DEBUG)
    logging.debug('hello')

# Path: peanut/utils.py
# def to_s(value):
#     return str(value)
# 
# def to_u(value):
#     return str(value)


# Path: peanut/logger.py
import six
import logging
from functools import partial
from peanut.utils import to_s, to_u


def pretty(func, prefix=None, fg=None, bg=None, attr=None):
    def wrapper(msg, *args, **kwargs):
        log = to_s(msg % args)
        _prefix = kwargs.get('prefix', prefix)
        if _prefix:
            log = to_s(_prefix) + log
        _fg = kwargs.get('fg', fg)
        _bg = kwargs.get('bg', bg)
        _attr = kwargs.get('attr', fg)
        log = color(to_s(log), _fg, _bg, _attr)
        func(log)
    return wrapper

# logging.VISIABLE
setattr(logging, 'VISIABLE', logging.INFO-1)

visiable = partial(logging.log, logging.VISIABLE)
logging.debug = pretty(logging.debug, prefix='☞  ')
logging.visiable = pretty(visiable, prefix='➔  ')
logging.info = pretty(logging.info, prefix='👉  ')
logging.warning = pretty(logging.warning, prefix='🌩  ', fg='yellow')
logging.error = pretty(logging.error, prefix='💥  ', fg='red')
logging.critical = pretty(logging.critical, prefix='💀  ',
        fg='red', attr='blod')


if __name__ == '__main__':
    init_logger(logging.DEBUG)
    logging.debug('hello')

    logging.info('hello')