# 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
# -*- coding: utf-8 -*-





def init_logger(level):
    logging.basicConfig(format='%(message)s', level=level)

_FORMAT = '\033[{}m\033[{};{}m{}\033[0m'

colors = ['black', 'red', 'green', 'yellow', 'blue',
        'magenta', 'cyan', 'white']
attributes = ['blod', 'underscore', 'blink', 'reverse', 'concealed']

_FOREGROUND = dict(zip(colors, list(range(30, 38))))
_BACKGROUND = dict(zip(colors, list(range(40, 48))))
_attributes = dict(zip(attributes, [1, 4, 5, 7, 8]))

def color(msg, fg, bg=None, attr=None):
    fg_code = _FOREGROUND.get(fg, 39)
    bg_code = _BACKGROUND.get(bg, 49)
    att_code = _attributes.get(attr, 0)
    return _FORMAT.format(att_code, bg_code, fg_code, msg)

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:

# 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

# -*- coding: utf-8 -*-





def init_logger(level):
    logging.basicConfig(format='%(message)s', level=level)

_FORMAT = '\033[{}m\033[{};{}m{}\033[0m'

colors = ['black', 'red', 'green', 'yellow', 'blue',
        'magenta', 'cyan', 'white']
attributes = ['blod', 'underscore', 'blink', 'reverse', 'concealed']

_FOREGROUND = dict(zip(colors, list(range(30, 38))))
_BACKGROUND = dict(zip(colors, list(range(40, 48))))
_attributes = dict(zip(attributes, [1, 4, 5, 7, 8]))

def color(msg, fg, bg=None, attr=None):
    fg_code = _FOREGROUND.get(fg, 39)
    bg_code = _BACKGROUND.get(bg, 49)
    att_code = _attributes.get(attr, 0)
    return _FORMAT.format(att_code, bg_code, fg_code, msg)

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