Log color formatting.
497404
def format(self, record):
        '''  '''
        levelname = record.levelname
        if levelname == 'CRITICAL':
            levelname = record.levelname = 'FATAL'
        record.asctime = self.formatTime(record, self.datefmt)

        # render the message part with arguments
        try:  # Allow {} style - need a faster way to determine this:
            message = record.getMessage()
        except TypeError:
            message = record.msg.format(*record.args)
        record.message = message

        fields = self._fields
        data = { name: getattr(record, name) for name in fields }
        if 'asctime' in fields and 'msecs' in fields:  # needs option for this
            data['asctime'] += '.{:03.0f}'.format(data.pop('msecs'))
        s = self.dumps(data)
        if self._highlight:
            s = self._highlight(s, get_lexer_by_name('JSON'), _term_formatter,
                                ).rstrip()

        # this needs to be here, Formatter class isn't very extensible.
        if record.exc_info:
            # Cache the traceback text to avoid converting it multiple times
            # (it's constant anyway)
            if not record.exc_text:
                record.exc_text = self.formatException(record.exc_info)
        if record.exc_text:
            if s[-1:] != "\n":
                s = s + "\n"
            s = s + record.exc_text
        if record.stack_info:
            if s[-1:] != "\n":
                s = s + "\n"
            s = s + self.formatStack(record.stack_info)
        return s
491755
def format(self, record):
        
        formatted = super(ColorFormatter, self).format(record)
        if self.verbose or not record.name.startswith(self.SPECIAL_SCOPE):
            return formatted

        # Arrow.
        formatted = '=> ' + formatted

        # Colors.
        if not self.colors:
            return formatted
        if record.levelno >= logging.ERROR:
            formatted = str(colorclass.Color.red(formatted))
        elif record.levelno >= logging.WARNING:
            formatted = str(colorclass.Color.yellow(formatted))
        else:
            formatted = str(colorclass.Color.cyan(formatted))
        return formatted
808569
function _log(type, message){
		var _debugger = $('div.lcars-debug pre');
		if( type == 'log' ){
			var message = '<span style="background:transparent;color:black">'+message+'</span>';
			_debugger.append(message+'<br>');
		}
		else if( type == 'warning' ){
			var message = '<span style="background:orange;color:black;">'+message+'</span>';
			_debugger.append(message+'<br>');
		}
		else if( type == 'error' ){
			var message = '<span style="background:#f00;color:white;font-weight:bold;">'+message+'</span>';
			_debugger.append(message+'<br>');
		}
		else if( type == 'info' ){
			var message = '<span style="background:#99f;color:white;">'+message+'</span>';
			_debugger.append(message+'<br>');
		}
		else{
			_debugger.append('<span style="background:#f00;color:white;font-weight:bold;">Unknown!</span><br>');
		}
}
757574
def log_with_color(level):
    
    def wrapper(text):
        color = log_colors_config[level.upper()]
        getattr(logger, level.lower())(coloring(text, color))

    return wrapper
1107618
def log(self, x, base=2):
        """"""
        return self._format_result(log(float(x), base))
1007593
function (logLevel) {
            return chalk.bgHex(logLevel.label.bgColor).hex(logLevel.label.color).bold;
        }
78268
def _colorbar_format(minval, maxval):
    """"""
    if not (np.isfinite(minval) and np.isfinite(maxval)):
        return str(maxval)
    else:
        return '%.{}f'.format(_digits(minval, maxval))
965934
def format(self, record):
        
        level = record.levelno

        if level >= logging.CRITICAL:
            color = self.CRITICAL
        elif level >= logging.ERROR:
            color = self.ERROR
        elif level >= logging.WARNING:
            color = self.WARNING
        elif level >= logging.INFO:
            color = self.INFO
        elif level >= logging.DEBUG:
            color = self.DEBUG
        else:
            color = self.DEFAULT

        message = super().format(record)
        if record.args:
            try:
                message = message % record.args
            except TypeError:
                # this happens when the message itself has some %s symbols, as
                # in traces for tracedumps
                pass

        return color + message + self.DEFAULT
204744
def format(self, record):
        """"""
        record = ColoredRecord(record)
        record.log_color = self.color(self.log_colors, record.levelname)

        # Set secondary log colors
        if self.secondary_log_colors:
            for name, log_colors in self.secondary_log_colors.items():
                color = self.color(log_colors, record.levelname)
                setattr(record, name + '_log_color', color)

        # Format the message
        if sys.version_info > (2, 7):
            message = super(ColoredFormatter, self).format(record)
        else:
            message = logging.Formatter.format(self, record)

        # Add a reset code to the end of the message
        # (if it wasn't explicitly added in format str)
        if self.reset and not message.endswith(escape_codes['reset']):
            message += escape_codes['reset']

        if '|' in message:
            desc, data = message.split("|", 1)
            desc = desc + escape_codes['reset']
            data = escape_codes['green'] + data
            message = desc + '|' + data

        return message
939004
def display(self, ret, indent, prefix, out):
        '''
        
        '''
        if isinstance(ret, six.string_types):
            lines = ret.split('\n')
            for line in lines:
                out += '{0}{1}{2}{3}{4}\n'.format(
                        self.colors['RED'],
                        ' ' * indent,
                        prefix,
                        line,
                        self.colors['ENDC'])
        elif isinstance(ret, dict):
            for key in sorted(ret):
                val = ret[key]
                out += '{0}{1}{2}{3}{4}:\n'.format(
                        self.colors['CYAN'],
                        ' ' * indent,
                        prefix,
                        key,
                        self.colors['ENDC'])
                out = self.display(val, indent + 4, '', out)
        return out
176464
def logstr(self):
        """"""

        result = []
        formater = LogFormatter(color=False)
        for record in self.logs:
            if isinstance(record, six.string_types):
                result.append(pretty_unicode(record))
            else:
                if record.exc_info:
                    a, b, tb = record.exc_info
                    tb = hide_me(tb, globals())
                    record.exc_info = a, b, tb
                result.append(pretty_unicode(formater.format(record)))
                result.append(u'\n')
        return u''.join(result)
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)
1336048
def colorize_logger(logger, stream=None, level=logging.DEBUG):
    
    logger.handlers = []
    logger.filters = []
    stream = stream or sys.stderr
    handler = logging.StreamHandler(stream=stream)
    handler.setLevel(level)
    handler.setFormatter(Colorful())
    logger.addHandler(handler)
    return logger
741280
function log(msg, color) {
        if (typeof(msg) === 'object') {
            for (var item in msg) {
                if (msg.hasOwnProperty(item)) {
                    if(color && color in $.util.colors) {
                        $.util.log($.util.colors[color](msg[item]));
                    }
                    $.util.log($.util.colors.lightgreen(msg[item]));
                }
            }
        } else {
            $.util.log($.util.colors.green(msg));
        }
    }
950840
def print_logs(self, logs, colorize=True, http=False, non_http=False, force_colorize=None):
        

        for log in logs:
            timestamp = log['timestamp']
            message = log['message']
            if "START RequestId" in message:
                continue
            if "REPORT RequestId" in message:
                continue
            if "END RequestId" in message:
                continue

            if not colorize and not force_colorize:
                if http:
                    if self.is_http_log_entry(message.strip()):
                        print("[" + str(timestamp) + "] " + message.strip())
                elif non_http:
                    if not self.is_http_log_entry(message.strip()):
                        print("[" + str(timestamp) + "] " + message.strip())
                else:
                    print("[" + str(timestamp) + "] " + message.strip())
            else:
                if http:
                    if self.is_http_log_entry(message.strip()):
                        click.echo(click.style("[", fg='cyan') + click.style(str(timestamp), bold=True) + click.style("]", fg='cyan') + self.colorize_log_entry(message.strip()), color=force_colorize)
                elif non_http:
                    if not self.is_http_log_entry(message.strip()):
                        click.echo(click.style("[", fg='cyan') + click.style(str(timestamp), bold=True) + click.style("]", fg='cyan') + self.colorize_log_entry(message.strip()), color=force_colorize)
                else:
                    click.echo(click.style("[", fg='cyan') + click.style(str(timestamp), bold=True) + click.style("]", fg='cyan') + self.colorize_log_entry(message.strip()), color=force_colorize)
101537
def _get_text_color(self):
        """"""

        color = self.code_array.cell_attributes[self.key]["textcolor"]
        return tuple(c / 255.0 for c in color_pack2rgb(color))
540304
def _set_log_format(color, include_caller):
    
    level_name = '* %(levelname)1s'
    time = '%(asctime)s,%(msecs)03d'
    message = '%(message)s'
    color_start = '%(color)s'
    color_end = '%(end_color)s'
    caller = '[%(module)s:%(lineno)d]'

    if color:
        if include_caller:
            return '{}{}{}  {}  {} {}'.format(color_start, level_name, color_end, time, message, caller)
        else:
            return '{}{}{}  {}  {}'.format(color_start, level_name, color_end, time, message)
    else:
        if include_caller:
            return '{}  {}  {} {}'.format(level_name, time, message, caller)
        else:
            return '{}  {}  {}'.format(level_name, time, message)