// newStdoutPrinter returns a tablePrinter which writes to os.Stdout.
179394
func newStdoutPrinter(forMachines bool) tablePrinter {
	if forMachines {
		return newMachineReadable(os.Stdout)
	}
	return newHumanReadable(os.Stdout)
}
324747
func (pb *ProgressBar) SetPrintAfter(after string) {
	pb.lock.Lock()
	pb.printAfter = after
	pb.lock.Unlock()
}
1313022
func printWebSource(w io.Writer, rpt *Report, obj plugin.ObjTool) error {
	printHeader(w, rpt)
	if err := PrintWebList(w, rpt, obj, -1); err != nil {
		return err
	}
	printPageClosing(w)
	return nil
}
709008
func NewStdoutClient(filename string, prefix string) *StdoutClient {
	var err error
	// allow %HOST% in the prefix string
	prefix = strings.Replace(prefix, "%HOST%", Hostname, 1)
	var fh *os.File
	if filename == "" {
		fh = os.Stdout
	} else {
		fh, err = os.OpenFile(filename, os.O_WRONLY, 0644)
		if nil != err {
			fmt.Printf("Cannot open file '%s' for stats output: %s\n", filename, err.Error())
		}
	}
	return &StdoutClient{
		FD:     fh,
		prefix: prefix,
		Logger: log.New(os.Stdout, "[StdoutClient] ", log.Ldate|log.Ltime),
	}
}
1222419
func printOSes(tsv bool, oses ...*crimson.OS) {
	if len(oses) > 0 {
		p := newStdoutPrinter(tsv)
		defer p.Flush()
		if !tsv {
			p.Row("Name", "Description")
		}
		for _, os := range oses {
			p.Row(os.Name, os.Description)
		}
	}
}
1200850
func (c *Conn) printLine(cmd string, args ...interface{}) {
	io.WriteString(c.c.W, cmd)
	for _, a := range args {
		c.c.W.Write(space)
		fmt.Fprint(c.c.W, a)
	}
	c.c.W.Write(crnl)
}
732572
func (r *readlineUI) PrintErr(args ...interface{}) {
	text := fmt.Sprint(args...)
	if !strings.HasSuffix(text, "\n") {
		text += "\n"
	}
	if readline.IsTerminal(int(syscall.Stderr)) {
		text = colorize(text)
	}
	fmt.Fprint(r.rl.Stderr(), text)
}
634341
func (s *sanitizer) printAttr(key, value string) {
	s.p(" ")
	s.p(key)
	s.p("=\"")
	s.p(html.EscapeString(value))
	s.p("\"")
}
238668
func NewStringAppender(buffer *bytes.Buffer) send.Sender {
	s, _ := send.NewStreamLogger("", stringAppender{buffer}, send.LevelInfo{Default: level.Debug, Threshold: level.Debug})
	return s
}
808130
func (p *printer) printTrace(a ...interface{}) {
	if !p.enableTrace {
		return
	}

	const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "
	const n = len(dots)
	i := 2 * p.indentTrace
	for i > n {
		fmt.Print(dots)
		i -= n
	}
	// i <= n
	fmt.Print(dots[0:i])
	fmt.Println(a...)
}
688729
func (dbg DebugPrinter) Print(v ...interface{}) {
	if dbg.Enabled {
		fmt.Fprint(dbg.out, v...)
	}
}
378569
func printRowsForHandlerEntry(output io.Writer, handler *handlerEntry, obj runtime.Object, options PrintOptions, includeHeaders bool) error {
	var results []reflect.Value

	args := []reflect.Value{reflect.ValueOf(obj), reflect.ValueOf(options)}
	results = handler.printFunc.Call(args)
	if !results[1].IsNil() {
		return results[1].Interface().(error)
	}

	if includeHeaders {
		var headers []string
		for _, column := range handler.columnDefinitions {
			if column.Priority != 0 && !options.Wide {
				continue
			}
			headers = append(headers, strings.ToUpper(column.Name))
		}
		headers = append(headers, formatLabelHeaders(options.ColumnLabels)...)
		// LABELS is always the last column.
		headers = append(headers, formatShowLabelsHeader(options.ShowLabels)...)
		if options.WithNamespace {
			headers = append(withNamespacePrefixColumns, headers...)
		}
		printHeader(headers, output)
	}

	if results[1].IsNil() {
		rows := results[0].Interface().([]metav1beta1.TableRow)
		printRows(output, rows, options)
		return nil
	}
	return results[1].Interface().(error)
}
520370
func (h *HumanReadablePrinter) TableHandler(columnDefinitions []metav1beta1.TableColumnDefinition, printFunc interface{}) error {
	printFuncValue := reflect.ValueOf(printFunc)
	if err := ValidateRowPrintHandlerFunc(printFuncValue); err != nil {
		utilruntime.HandleError(fmt.Errorf("unable to register print function: %v", err))
		return err
	}
	entry := &handlerEntry{
		columnDefinitions: columnDefinitions,
		printFunc:         printFuncValue,
	}

	objType := printFuncValue.Type().In(0)
	if _, ok := h.handlerMap[objType]; ok {
		err := fmt.Errorf("registered duplicate printer for %v", objType)
		utilruntime.HandleError(err)
		return err
	}
	h.handlerMap[objType] = entry
	return nil
}
766432
func NewStandardFormatter(format string, dateFormat string) *StandardFormatter {
	toFormatTime := false
	size := 0
	f1 := func(match string) string {
		if match == "%%" {
			return "%"
		}
		if match == "%(asctime)s" {
			toFormatTime = true
		}
		size++
		return "%s"
	}
	strFormat := formatRe.ReplaceAllStringFunc(format, f1)
	funs := make([]ExtractAttr, 0, size)
	f2 := func(match string) string {
		extractFunc, ok := attrToFunc[match]
		if ok {
			funs = append(funs, extractFunc)
		}
		return match
	}
	formatRe.ReplaceAllStringFunc(format, f2)
	getFormatArgsFunc := func(record *LogRecord) []interface{} {
		result := make([]interface{}, 0, len(funs))
		for _, f := range funs {
			result = append(result, f(record))
		}
		return result
	}
	var dateFormatter *strftime.Formatter
	if toFormatTime {
		dateFormatter = strftime.NewFormatter(dateFormat)
	}
	return &StandardFormatter{
		format:            format,
		strFormat:         strFormat + "\n",
		getFormatArgsFunc: getFormatArgsFunc,
		toFormatTime:      toFormatTime,
		dateFormat:        dateFormat,
		dateFormatter:     dateFormatter,
	}
}
242442
func (tp *TabPrinter) Println() {
	if tp.current > 0 {
		fmt.Fprintln(tp.w, "")
		tp.w.Flush()
	}

	tp.current = 0
}
1302512
func Print(foreground, background Color, v ...interface{}) (int, error) {
	return Fprint(os.Stdout, foreground, background, v...)
}
857287
func printFunctionHeader(w io.Writer, name, path string, flatSum, cumSum int64, rpt *Report) {
	fmt.Fprintf(w, `<h1>%s</h1>%s
<pre onClick="pprof_toggle_asm()">
  Total:  %10s %10s (flat, cum) %s
`,
		template.HTMLEscapeString(name), template.HTMLEscapeString(path),
		rpt.formatValue(flatSum), rpt.formatValue(cumSum),
		percentage(cumSum, rpt.total))
}