Print a message with a specific color.
428760
def log(color, *args):
    
    if color in c.LOG_COLOR.keys():
        out_color = c.LOG_COLOR[color]
    else:
        out_color = color

    for arg in args:
        print clr.stringc(arg, out_color)
488602
def message(msg, indent=False, mtype='standard', caption=False):
    """"""
    if caption:
        msg = '\n' + msg + '\n' + '-'*len(msg) + '\n'
    if mtype == 'warning':
        msg = colorlog('Warning:  ' + msg, 'yellow')
    if mtype == 'error':
        msg = colorlog('Error:  ' + msg, 'red')
    if mtype == 'debug':
        msg = colorlog('Debug:  ' + msg, 'pink')
    if mtype == 'info':
        msg = colorlog('Info:  ' + msg, 'green')
    if indent:
        msg = '  ' + msg
    sys.stderr.write(msg)
696493
def color_msg(msg, color):
    "  "
    return ''.join((COLORS.get(color, COLORS['endc']), msg, COLORS['endc']))
181607
def _TryPrintAsAnyMessage(self, message):
    """"""
    packed_message = _BuildMessageFromTypeName(message.TypeName(),
                                               self.descriptor_pool)
    if packed_message:
      packed_message.MergeFromString(message.value)
      self.out.write('%s[%s]' % (self.indent * ' ', message.type_url))
      self._PrintMessageFieldValue(packed_message)
      self.out.write(' ' if self.as_one_line else '\n')
      return True
    else:
      return False
790112
def msg_warn(message):
    
    to_stdout(" (!) {message}".format(message=message),
              colorf=yellow, bold=True)
    if _logger:
        _logger.warn(message)
938513
def print_failure_message(message):
    
    try:
        import colorama

        print(colorama.Fore.RED + message + colorama.Fore.RESET,
              file=sys.stderr)
    except ImportError:
        print(message, file=sys.stderr)
1302067
def print_warning(msg, color=True):
    
    if color and is_posix():
        safe_print(u"%s[WARN] %s%s" % (ANSI_WARNING, msg, ANSI_END))
    else:
        safe_print(u"[WARN] %s" % (msg))
1240934
public String colorize(String message){
        if(SUPPORTED){
            StringBuilder buff = new StringBuilder(start.length()+message.length()+END.length());
            buff.append(start).append(message).append(END);
            return buff.toString();
        }else
            return message;
    }
933578
def colorlogs(format="short"):
    """"""
    try:
        from rainbow_logging_handler import RainbowLoggingHandler
        import sys
        # setup `RainbowLoggingHandler`
        logger = logging.root
        # same as default
        if format == "short":
            fmt = "%(message)s "
        else:
            fmt = "[%(asctime)s] %(name)s %(funcName)s():%(lineno)d\t%(message)s [%(levelname)s]"
        formatter = logging.Formatter(fmt)
        handler = RainbowLoggingHandler(sys.stderr,
                                        color_funcName=('black', 'gray', True))
        handler.setFormatter(formatter)
        logger.addHandler(handler)
    except ImportError:
        # rainbow logger not found, that's ok
        pass
773086
def display(self, messages, sig="", debug=False):
        """"""
        full_message = "".join(
            sig + line for line in " ".join(
                str(msg) for msg in messages
            ).splitlines(True)
        )
        if not full_message:
            full_message = sig.rstrip()
        if debug:
            printerr(full_message)
        else:
            print(full_message)
208512
def paint(color_name, msg)
      if @colors == false || @colors == nil && (Util::OS.windows? || !$stderr.tty?)
        msg
      else
        COLORS[color_name] + msg + CLEAR
      end
    end
684651
function (msg, colors) {

        if (!colors) {
            return msg;
        }

        if (typeof colors === 'string') {
            colors = [colors];
        }

        colors.forEach(function (color) {
            if (typeof colorsjs[color] === 'function') {
                msg = colorsjs[color](msg);
            }
        });

        return msg;
    }
60420
def pretty_print(self):
        
        msg = "Source: " + str(self._source) + "\n"
        msg += "Destination: " + str(self._destination) + "\n"
        inv_types = {v: k for k, v in defines.Types.items()}
        msg += "Type: " + str(inv_types[self._type]) + "\n"
        msg += "MID: " + str(self._mid) + "\n"
        if self._code is None:
            self._code = 0

        msg += "Code: " + str(defines.Codes.LIST[self._code].name) + "\n"
        msg += "Token: " + str(self._token) + "\n"
        for opt in self._options:
            msg += str(opt)
        msg += "Payload: " + "\n"
        msg += str(self._payload) + "\n"
        return msg
511972
def fprint(fmt, *args, **kwargs):
    
    if not fmt:
        return

    hascolor = False
    target = kwargs.get("target", sys.stdout)

    # Format the string before feeding it to the parser
    fmt = fmt.format(*args, **kwargs)

    for txt, markups in _color_format_parser.parse(fmt):
        if markups != (None, None):
            _color_manager.set_color(*markups)
            hascolor = True
        else:
            if hascolor:
                _color_manager.set_defaults()
                hascolor = False

        target.write(txt)
        target.flush()  # Needed for Python 3.x

    _color_manager.set_defaults()
    target.write(kwargs.get('end', '\n'))
    _color_manager.set_defaults()
990373
def printy(s):
    """"""
    if hasattr(s, 'as_utf8'):
        if hasattr(sys.stdout, 'buffer'):
            sys.stdout.buffer.write(s.as_utf8)
            sys.stdout.buffer.write(b"\n")
        else:
            sys.stdout.write(s.as_utf8)
            sys.stdout.write(b"\n")
    else:
        print(s)
332452
def cprint(text, color=None, on_color=None, attrs=None, **kwargs):
    
    try:
        print((colored(text, color, on_color, attrs)), **kwargs)
    except TypeError:
        # flush is not supported by py2.7
        kwargs.pop("flush", None)
        print((colored(text, color, on_color, attrs)), **kwargs)
142142
def _special(self, message: str, with_gap: bool=True):
        
        if with_gap:
            self._line_break()
        self._log(self._set_color(message, self.GREEN))