// Output writes a string log with timestamp and log level to the output.
// If the level is greater than logger level, the log will be omitted.
// The log will be format by timeFormat and logFormat.
191741
func (l *Logger) Output(t time.Time, level Level, s string) (err error) {
	l.mu.Lock()
	defer l.mu.Unlock()

	if l := len(s); l > 0 && s[l-1] == '\n' {
		s = s[0 : l-1]
	}
	_, err = fmt.Fprintf(l.Out, l.lf, t.UTC().Format(l.tf), level.String(), crlfEscaper.Replace(s))
	if err == nil {
		l.Out.Write([]byte{'\n'})
	}
	return
}
705714
func Output(r cruntime.Manager, bs bootstrapper.Bootstrapper, runner bootstrapper.CommandRunner, lines int) error {
	cmds := logCommands(r, bs, lines, false)

	// These are not technically logs, but are useful to have in bug reports.
	cmds["kernel"] = "uptime && uname -a"

	names := []string{}
	for k := range cmds {
		names = append(names, k)
	}
	sort.Strings(names)

	failed := []string{}
	for i, name := range names {
		if i > 0 {
			console.OutLn("")
		}
		console.OutLn("==> %s <==", name)
		var b bytes.Buffer
		err := runner.CombinedOutputTo(cmds[name], &b)
		if err != nil {
			glog.Errorf("failed: %v", err)
			failed = append(failed, name)
			continue
		}
		scanner := bufio.NewScanner(&b)
		for scanner.Scan() {
			console.OutLn(scanner.Text())
		}
	}
	if len(failed) > 0 {
		return fmt.Errorf("unable to fetch logs for: %s", strings.Join(failed, ", "))
	}
	return nil
}
164939
func output(stack *cloudformation.Stack, key string) (output *cloudformation.Output) {
	for _, o := range stack.Outputs {
		if *o.OutputKey == key {
			output = o
		}
	}
	return
}
1022146
func (logger *Logger) Logf(level log.Level, format string, args ...interface{}) {
	logger.output(level, fmt.Sprintf(format, args...))
}
1304862
func (l *FileLogger) output(msg *Message) {
	if l.mode == ROTATE && l.curLines >= l.maxLines && !l.errored {
		err := l.rotate()
		if err != nil {
			// if we can't rotate the logs, we should stop logging to prevent the log file from growing
			// past the limit and continuously retrying the rotate operation (but log current msg first)
			l.printLog(msg)
			l.printLog(&Message{len(l.levels) - 1, fmt.Sprintf("Error rotating logs: %s. Closing log."), time.Now()})
			l.errored = true
			l.close()
		}
	}
	l.printLog(msg)
}
975965
func (log *SQLLogger) Printf(format string, v ...interface{}) {
	log.Debugf(format, v...)
}
1105770
func (l Logger) Output(w io.Writer) Logger {
	l2 := New(w)
	l2.level = l.level
	l2.sampler = l.sampler
	if len(l.hooks) > 0 {
		l2.hooks = append(l2.hooks, l.hooks...)
	}
	if l.context != nil {
		l2.context = make([]byte, len(l.context), cap(l.context))
		copy(l2.context, l.context)
	}
	return l2
}
373539
func (fs *FileSorter) Output() ([]types.Datum, []types.Datum, int64, error) {
	var (
		r   *comparableRow
		err error
	)
	if fs.closed {
		return nil, nil, 0, errors.New("FileSorter has been closed")
	}

	if fs.external {
		r, err = fs.externalSort()
	} else {
		r, err = fs.internalSort()
	}

	if err != nil {
		return nil, nil, 0, errors.Trace(err)
	} else if r != nil {
		return r.key, r.val, r.handle, nil
	} else {
		return nil, nil, 0, nil
	}
}
880351
func (w LogWriter) Write(bytes []byte) (int, error) {
	if len(bytes) > 0 {
		return fmt.Fprint(Output, Yellow.Regular("["), time.Now().Format("15:04:05"), Yellow.Regular("]"), string(bytes))
	}
	return 0, nil
}
881442
func (l *Logger) Output(lv Level, calldepth int, s string) error {
	if lv >= l.min {
		if (l.flag & Llevel) != 0 {
			return l.lg.Output(calldepth, fmt.Sprintf("[%v] %s", lv, s))
		}
		return l.lg.Output(calldepth, s)
	}
	return nil
}
351846
func (l *Logger) Print(v ...interface{}) {
	l.Emit(0, fmt.Sprint(v...), nil)
}
69013
func (c *ColorLogger) Out(bytes []byte) {
	if len(bytes) == 0 {
		return
	}
	logFmt, name := c.getLogFmt()
	message := fmt.Sprintf(logFmt, name, string(bytes))
	fmt.Print(message)
}
279743
func Out(format string, a ...interface{}) error {
	p := message.NewPrinter(preferredLanguage)
	if outFile == nil {
		if _, err := p.Fprintf(os.Stdout, "(stdout unset)"+format, a...); err != nil {
			return err
		}
		return fmt.Errorf("no output file has been set")
	}
	_, err := p.Fprintf(outFile, format, a...)
	return err
}
1282921
func (l *Logger) Printf(format string, v ...interface{}) {
	l.Emit(0, fmt.Sprintf(format, v...), nil)
}
1311313
func OutputFormat(s string) string {
	var buf bytes.Buffer
	for _, old := range s {
		if newVal, ok := replace[old]; ok {
			buf.WriteString(newVal)
			continue
		}
		buf.WriteRune(old)
	}

	return buf.String()
}
1177254
func (l *Logger) Printf(format string, args ...interface{}) {
	l.print(DisableLevel, fmt.Sprintf(format, args...), l.NewLine)
}
48431
func (p LogPrinter) Printf(logger *Logger, format string, a ...interface{}) {
	format = "%s " + format
	b := make([]interface{}, 1)
	b[0] = logger.Color(logger.Name)
	a = append(b, a...)
	log.Printf(format, a...)
}