Format command information for logging.
194884
def format_command(
    command_args,  # type: List[str]
    command_output,  # type: str
):
    # type: (...) -> str
    
    text = 'Command arguments: {}\n'.format(command_args)

    if not command_output:
        text += 'Command output: None'
    elif logger.getEffectiveLevel() > logging.DEBUG:
        text += 'Command output: [use --verbose to show]'
    else:
        if not command_output.endswith('\n'):
            command_output += '\n'
        text += (
            'Command output:\n{}'
            '-----------------------------------------'
        ).format(command_output)

    return text
948074
public void printCommandInfo(CommandInfo info) {
        final PrintContext context = new PrintContext();

        // Print command name : description
        final CliCommand command = info.getCommand();
        printIdentifiable(context, command);

        // Print bound params.
        final BoundParams boundParams = info.getBoundParams();
        printBoundParams(context, command, boundParams);
    }
167435
def format(self, record):
        """"""
        if hasattr(record, 'data'):
            return "%s. DEBUG DATA=%s" % (
                logging.Formatter.format(self, record),
                record.__dict__['data'])
        return logging.Formatter.format(self, record)
231422
def command_info(self, command, *commands):
        """"""
        return self.execute(b'COMMAND', b'INFO', command, *commands,
                            encoding='utf-8')
1175802
def shprint(command, *args, **kwargs):
    ''''''
    kwargs["_iter"] = True
    kwargs["_out_bufsize"] = 1
    kwargs["_err_to_out"] = True
    kwargs["_bg"] = True
    is_critical = kwargs.pop('_critical', False)
    tail_n = kwargs.pop('_tail', None)
    full_debug = False
    if "P4A_FULL_DEBUG" in os.environ:
        tail_n = 0
        full_debug = True
    filter_in = kwargs.pop('_filter', None)
    filter_out = kwargs.pop('_filterout', None)
    if len(logger.handlers) > 1:
        logger.removeHandler(logger.handlers[1])
    columns = get_console_width()
    command_path = str(command).split('/')
    command_string = command_path[-1]
    string = ' '.join(['{}->{} running'.format(Out_Fore.LIGHTBLACK_EX,
                                               Out_Style.RESET_ALL),
                       command_string] + list(args))

    # If logging is not in DEBUG mode, trim the command if necessary
    if logger.level > logging.DEBUG:
        logger.info('{}{}'.format(shorten_string(string, columns - 12),
                                  Err_Style.RESET_ALL))
    else:
        logger.debug('{}{}'.format(string, Err_Style.RESET_ALL))

    need_closing_newline = False
    try:
        msg_hdr = '           working: '
        msg_width = columns - len(msg_hdr) - 1
        output = command(*args, **kwargs)
        for line in output:
            if isinstance(line, bytes):
                line = line.decode('utf-8', errors='replace')
            if logger.level > logging.DEBUG:
                if full_debug:
                    stdout.write(line)
                    stdout.flush()
                    continue
                msg = line.replace(
                    '\n', ' ').replace(
                        '\t', ' ').replace(
                            '\b', ' ').rstrip()
                if msg:
                    if "CI" not in os.environ:
                        stdout.write(u'{}\r{}{:<{width}}'.format(
                            Err_Style.RESET_ALL, msg_hdr,
                            shorten_string(msg, msg_width), width=msg_width))
                        stdout.flush()
                        need_closing_newline = True
            else:
                logger.debug(''.join(['\t', line.rstrip()]))
        if need_closing_newline:
            stdout.write('{}\r{:>{width}}\r'.format(
                Err_Style.RESET_ALL, ' ', width=(columns - 1)))
            stdout.flush()
    except sh.ErrorReturnCode as err:
        if need_closing_newline:
            stdout.write('{}\r{:>{width}}\r'.format(
                Err_Style.RESET_ALL, ' ', width=(columns - 1)))
            stdout.flush()
        if tail_n is not None or filter_in or filter_out:
            def printtail(out, name, forecolor, tail_n=0,
                          re_filter_in=None, re_filter_out=None):
                lines = out.splitlines()
                if re_filter_in is not None:
                    lines = [l for l in lines if re_filter_in.search(l)]
                if re_filter_out is not None:
                    lines = [l for l in lines if not re_filter_out.search(l)]
                if tail_n == 0 or len(lines) <= tail_n:
                    info('{}:\n{}\t{}{}'.format(
                        name, forecolor, '\t\n'.join(lines), Out_Fore.RESET))
                else:
                    info('{} (last {} lines of {}):\n{}\t{}{}'.format(
                        name, tail_n, len(lines),
                        forecolor, '\t\n'.join([s for s in lines[-tail_n:]]),
                        Out_Fore.RESET))
            printtail(err.stdout.decode('utf-8'), 'STDOUT', Out_Fore.YELLOW, tail_n,
                      re.compile(filter_in) if filter_in else None,
                      re.compile(filter_out) if filter_out else None)
            printtail(err.stderr.decode('utf-8'), 'STDERR', Err_Fore.RED)
        if is_critical:
            env = kwargs.get("env")
            if env is not None:
                info("{}ENV:{}\n{}\n".format(
                    Err_Fore.YELLOW, Err_Fore.RESET, "\n".join(
                        "set {}={}".format(n, v) for n, v in env.items())))
            info("{}COMMAND:{}\ncd {} && {} {}\n".format(
                Err_Fore.YELLOW, Err_Fore.RESET, os.getcwd(), command,
                ' '.join(args)))
            warning("{}ERROR: {} failed!{}".format(
                Err_Fore.RED, command, Err_Fore.RESET))
            exit(1)
        else:
            raise

    return output
95974
private static String formatLogParam(Array obj) {
		String result="";
		try {
			result= "(array of type"+obj.getBaseTypeName().length()+")";
		} catch (SQLException e) {
			result = "(array of unknown type)";
		}
		return result;
	}
1212437
def _format_args():
        """"""
        if request and request.args.get('prettyprint'):
            return dict(
                indent=2,
                separators=(', ', ': '),
            )
        else:
            return dict(
                indent=None,
                separators=(',', ':'),
            )
645339
def printlog(self, string, verbose=None, flush=False):
        """"""
        if self.writelog:
            self.logger.info(string)
        if verbose or (self.verbose and verbose is None):
            print(string, flush=flush)
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
811753
def log_to_json(log):
    """"""
    return [log.timestamp.isoformat()[:22],
            log.level, log.process, log.message]
7222
def log(self, msg, *args):
        """"""
        if args:
            msg %= args
        click.echo(msg, file=sys.stderr)
1247053
def do_log(self, line):
        """"""
        path = self._split_args(line, 0, 1, pad=False)
        if len(path):
            path = path[0]
        self._command_processor.log(path)
338165
def write_log(title, message=''):
    """"""

    sys.stderr.write(''.join([
        title.center(40).center(60, '-'), '\n', message
    ]))
101976
def log_prefix(self, prefix, *messages):
        """"""
        if self.verbose:
            self.display(messages, prefix, debug=True)
984104
public void info(String format, Object arg) {
        if (logger.isInfoEnabled()) {
            FormattingTuple ft = MessageFormatter.format(format, arg);
            logger.log(FQCN, Level.INFO, ft.getMessage(), ft.getThrowable());
        }
    }
428713
def log_status(cmd, message, verbose, color = false)
      return unless verbose

      cmd = cmd.to_s.rjust(12)
      if color
        i = cmd.index(/[a-z]/)
        cmd = cmd[0...i] + decorate(cmd[i..-1], color)
      end

      message = "#{cmd}  #{message}"
      message += "\n" unless message.end_with?("\n")

      @output.print(message)
      @output.flush
    end
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