Set log format
    :param color: Log message is colored
    :param include_caller: At the end, put a [caller:line-of-code], e.g. [script:123]
    :return: string of log format
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)
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
401096
def _header(self, message: str, with_gap=True):
        
        if with_gap:
            self._line_break()
        self._log(self._set_color(message, self.YELLOW))
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
62106
def cprint(color, prefix, message):
        
        message = message or ""
        prefix = prefix or ""
        print((Console.theme[color] +
               prefix +
               message +
               Console.theme['ENDC']))
922376
def format_color(text, color, use_color_setting):
    
    if not use_color_setting:
        return text
    else:
        return '{}{}{}'.format(color, text, NORMAL)
693658
def setup_logging(log_level=logging.INFO):
    """"""
    logging.basicConfig(level=log_level)
    fmt = ("%(asctime)s %(levelname)s (%(threadName)s) "
           "[%(name)s] %(message)s")
    colorfmt = "%(log_color)s{}%(reset)s".format(fmt)
    datefmt = '%Y-%m-%d %H:%M:%S'

    # Suppress overly verbose logs from libraries that aren't helpful
    logging.getLogger('requests').setLevel(logging.WARNING)

    try:
        from colorlog import ColoredFormatter
        logging.getLogger().handlers[0].setFormatter(ColoredFormatter(
            colorfmt,
            datefmt=datefmt,
            reset=True,
            log_colors={
                'DEBUG': 'cyan',
                'INFO': 'green',
                'WARNING': 'yellow',
                'ERROR': 'red',
                'CRITICAL': 'red',
            }
        ))
    except ImportError:
        pass

    logger = logging.getLogger('')
    logger.setLevel(log_level)
1306280
public void importColor(String colorNr, Color color) {
        RtfColor rtfColor = new RtfColor(this.rtfDoc, color);
        this.importColorMapping.put(colorNr, Integer.toString(rtfColor.getColorNumber()));
    }
357044
def format_entry(record, show_level=False, colorize=False):
    
    if show_level:
        log_str = u'{}: {}'.format(record.levelname, record.getMessage())
    else:
        log_str = record.getMessage()

    if colorize and record.levelname in LOG_COLORS:
        log_str = u'<span color="{}">'.format(LOG_COLORS[record.levelname]) + log_str + u'</span>'

    return log_str
437010
function log(type, args, color){
  pad();
  var msg = format.apply(format, args);
  if (color) msg = chalk[color](msg);
  var pre = prefix();
  console[type](pre, msg);
}
298881
def call ( severity, time, progname, msg )
      msg = Format % [format_datetime(time), severity, $$, progname, msg2str(msg)]
      msg = @@colors[severity] + msg + @@colors['DEFAULT'] if @@colorize
      msg << "\n"
    end
1307393
def format(self, record):
        
        if not self.is_tty:
            return super(CLIHandler, self).format(record)

        level_abbrev = record.levelname[0]

        time_and_level = color_string(
            color_for_level(record.levelno),
            "[%(asctime)s " + level_abbrev + "]"
        )
        thread = color_string(
            color_for_thread(record.thread),
            "[%(threadName)s]"
        )
        formatter = logging.Formatter(
            time_and_level + thread + " %(message)s", "%Y-%m-%d %H:%M:%S"
        )

        return formatter.format(record)
1272847
function message( data , color ) {
	var k , messageString = '' ;

	if ( data.mon ) {
		messageString = '\n' ;

		if ( color ) {
			for ( k in data.mon ) {
				messageString += string.ansi.green + k + string.ansi.reset + ': ' +
					string.ansi.cyan + data.mon[ k ] + string.ansi.reset + '\n' ;
			}
		}
		else {
			for ( k in data.mon ) { messageString += k + ': ' + data.mon[ k ] + '\n' ; }
		}
	}
	else if ( Array.isArray( data.messageData ) && data.isFormat ) {
		//if ( color ) { messageString = string.ansi.italic + string.formatMethod.apply( { color: true } , data.messageData ) ; }
		//else { messageString = string.formatMethod.apply( { color: false } , data.messageData ) ; }

		messageString = string.formatMethod.apply( color ? formatColor : format , data.messageData ) ;
	}
	else if ( data.messageData instanceof Error ) {
		messageString = string.inspectError( { style: color ? 'color' : 'none' } , data.messageData ) ;
	}
	else if ( typeof data.messageData !== 'string' ) {
		messageString = string.inspect( { style: color ? 'color' : 'none' } , data.messageData ) ;
	}
	else {
		// Even if messageData is not an array, it may contains markup, so it should be formated anyway
		//messageString = data.messageData ;
		messageString = string.formatMethod.call( color ? formatColor : format , data.messageData ) ;
	}

	return messageString ;
}
632772
def setup_logging(format="%(asctime)s - %(levelname)s - %(message)s", level='INFO'):
    """"""
    try:
        import coloredlogs
        coloredlogs.install(fmt=format, level=level)
    except ImportError:
        logging.basicConfig(format=format, level=level)
142142
def _special(self, message: str, with_gap: bool=True):
        
        if with_gap:
            self._line_break()
        self._log(self._set_color(message, self.GREEN))
887854
def colorize(message, color=None):
    """"""
    if not color:
        return message

    colors = {
        "green": colorama.Fore.GREEN,
        "yellow": colorama.Fore.YELLOW,
        "blue": colorama.Fore.BLUE,
        "red": colorama.Fore.RED,
    }

    return "{color}{message}{nc}".format(
        color=colors.get(color, ""), message=message, nc=colorama.Fore.RESET
    )
676483
def log_call(call_name):
    """"""
    def decorator(f):
        @wraps(f)
        def wrapper(*args, **kw):
            instance = args[0]
            instance.logger.info(call_name, {"content": request.get_json()})
            return f(*args, **kw)
        return wrapper
    return decorator