// Format takes and entry and returns the formatted output in bytes
433607
func (sf *StdFormatter) Format(e *Entry) ([]byte, error) {

	// Initialize if not set
	if sf.HeaderColor == nil {
		sf.mu.Lock()
		sf.HeaderColor = colorLabels
		sf.mu.Unlock()
	}

	// Initialize if not set
	if sf.HeaderPlain == nil {
		sf.mu.Lock()
		sf.HeaderPlain = plainLabels
		sf.mu.Unlock()
	}

	// Normal headers.  time, file, etc
	var header, message []byte
	sf.stdHeader(&header, e.Time, e.Prefix, e.File, e.Line)

	// Level headers
	headers := sf.levelHeaders()
	message = append(headers[e.Level], append(header, e.Message...)...)

	if e.Fields != nil {
		sf.stdFields(&message, e.Fields, e.Level)
	}

	return append(message, '\n'), nil
}
1136261
func (s String) Format(sep string) string {
	return strings.Join([]string(s), sep)
}
1070511
func (s SequenceFormatter) Format(w io.Writer, entry zapcore.Entry, fields []zapcore.Field) {
	fmt.Fprintf(w, s.FormatVerb, atomic.AddUint64(&sequence, 1))
}
1117649
func Format(record []string) string {
	buffer := bytes.NewBufferString("")
	writer := csv.NewWriter(buffer)
	writer.Write(record)
	writer.Flush()
	return strings.TrimRight(buffer.String(), "\n")
}
888244
func (p *PercentilesBucketAggregation) Format(format string) *PercentilesBucketAggregation {
	p.format = format
	return p
}
35407
func format(enc []byte, mime string) string {
	switch mime {
	case "image/gif", "image/jpeg", "image/pjpeg", "image/png", "image/tiff":
		return fmt.Sprintf("data:%s;base64,%s", mime, enc)
	default:
	}

	return fmt.Sprintf("data:image/png;base64,%s", enc)
}
839024
func (g *Generator) Format() ([]byte, error) {
	src, err := format.Source(g.Buf.Bytes())
	if err != nil {
		return g.Buf.Bytes(), err
	}

	return src, nil
}
1244734
func (w *Writer) format(p Priority, hostname, tag, msg string) []byte {
	b := w.b[0:0]
	b = append(b, '<')
	b = itoa(b, int(p))
	b = append(b, '>')
	b = time.Now().AppendFormat(b, time.RFC3339)
	b = append(b, ' ')
	b = append(b, hostname...)
	b = append(b, ' ')
	b = append(b, tag...)
	b = append(b, '[')
	b = itoa(b, w.getpid())
	b = append(b, "]: "...)
	b = append(b, msg...)
	if b[len(b)-1] != '\n' {
		b = append(b, '\n')
	}
	if len(b) < maxBufSize {
		w.b = b
	}
	return b
}
1193151
func Format(i int64, units Units, width int) string {
	switch units {
	case U_BYTES:
		return FormatBytes(i)
	default:
		// by default just convert to string
		return fmt.Sprintf(fmt.Sprintf("%%%dd", width), i)
	}
}
757768
func (f LogstashFormatter) Format(e *logrus.Entry) ([]byte, error) {
	ne := copyEntry(e, f.Fields)
	dataBytes, err := f.Formatter.Format(ne)
	releaseEntry(ne)
	return dataBytes, err
}
397749
func (s *IndicesAnalyzeService) Format(format string) *IndicesAnalyzeService {
	s.format = format
	return s
}
1333982
func (t *ConsoleFormatter) Format(errin error) (errtext string, err error) {
	return t.FormatSkip(errin, 1)
}
910156
func (l LevelFormatter) Format(w io.Writer, entry zapcore.Entry, fields []zapcore.Field) {
	fmt.Fprintf(w, l.FormatVerb, entry.Level.CapitalString())
}
1154124
func (e Error) Format(a ...interface{}) Error {
	e.Message = fmt.Sprintf(e.Message, a...)
	return e
}
1354142
func (pb *Bar) Format(format string) *Bar {
	var formatEntries []string
	if len(format) == 5 {
		formatEntries = strings.Split(format, "")
	} else {
		formatEntries = strings.Split(format, "\x00")
	}
	if len(formatEntries) == 5 {
		pb.BarStart = formatEntries[0]
		pb.BarEnd = formatEntries[4]
		pb.Empty = formatEntries[3]
		pb.Current = formatEntries[1]
		pb.CurrentN = formatEntries[2]
	}
	return pb
}
485525
func (tf *TextFormatter) Format(e *log.Entry) (data []byte, err error) {
	defer func() {
		if r := recover(); r != nil {
			data = append([]byte("panic in log formatter\n"), rundebug.Stack()...)
			return
		}
	}()

	var file string
	if cursor := findFrame(); cursor != nil {
		t := newTraceFromFrames(*cursor, nil)
		file = t.Loc()
	}

	w := &writer{}

	// time
	if !tf.DisableTimestamp {
		w.writeField(e.Time.Format(time.RFC3339), noColor)
	}

	// level
	color := noColor
	if tf.EnableColors {
		switch e.Level {
		case log.DebugLevel:
			color = gray
		case log.WarnLevel:
			color = yellow
		case log.ErrorLevel, log.FatalLevel, log.PanicLevel:
			color = red
		default:
			color = blue
		}
	}
	w.writeField(strings.ToUpper(padMax(e.Level.String(), DefaultLevelPadding)), color)

	// always output the component field if available
	padding := DefaultComponentPadding
	if tf.ComponentPadding != 0 {
		padding = tf.ComponentPadding
	}
	if w.Len() > 0 {
		w.WriteByte(' ')
	}
	value := e.Data[Component]
	var component string
	if reflect.ValueOf(value).IsValid() {
		component = fmt.Sprintf("[%v]", value)
	}
	component = strings.ToUpper(padMax(component, padding))
	if component[len(component)-1] != ' ' {
		component = component[:len(component)-1] + "]"
	}
	w.WriteString(component)

	// message
	if e.Message != "" {
		w.writeField(e.Message, noColor)
	}

	// rest of the fields
	if len(e.Data) > 0 {
		w.writeMap(e.Data)
	}

	// file, if present, always last
	if file != "" {
		w.writeField(file, noColor)
	}

	w.WriteByte('\n')
	data = w.Bytes()
	return
}
149057
func (m *MultiFormatter) Format(w io.Writer, entry zapcore.Entry, fields []zapcore.Field) {
	m.mutex.RLock()
	for i := range m.formatters {
		m.formatters[i].Format(w, entry, fields)
	}
	m.mutex.RUnlock()
}