// Format implements fmt.Formatter, formatting to hours, minutes, and seconds.
519450
func (ra *RA) Format(f fmt.State, c rune) {
	s := &state{
		State: f,
		verb:  c,
		// pmod in case ra.RA was directly set to something out of range
		hrDeg:  unit.PMod(ra.Hour(), 24),
		caller: fsRA,
		sym:    ra.Sym,
	}
	ra.Err = s.writeFormatted()
}
1271772
func (*Bytes) Format(b int64) string {
	multiple := ""
	value := float64(b)

	switch {
	case b < KB:
		return strconv.FormatInt(b, 10) + "B"
	case b < MB:
		value /= KB
		multiple = "KB"
	case b < MB:
		value /= KB
		multiple = "KB"
	case b < GB:
		value /= MB
		multiple = "MB"
	case b < TB:
		value /= GB
		multiple = "GB"
	case b < PB:
		value /= TB
		multiple = "TB"
	case b < EB:
		value /= PB
		multiple = "PB"
	}

	return fmt.Sprintf("%.02f%s", value, multiple)
}
690765
func (_ *NilFormatter) Format(_ string, _ LogLevel, _ int, _ ...interface{}) {
	// noop
}
842606
func (cfg Config) Format(t time.Time) string {
	return cfg.FormatReference(t, time.Now())
}
611129
func (f RangeFilter) Format(format string) RangeFilter {
	f.format = format
	return f
}
1187911
func (a *SerialDiffAggregation) Format(format string) *SerialDiffAggregation {
	a.format = format
	return a
}
258651
func (st LString) Format(f fmt.State, c rune) {
	switch c {
	case 'd', 'i':
		if nm, err := parseNumber(string(st)); err != nil {
			defaultFormat(nm, f, 'd')
		} else {
			defaultFormat(string(st), f, 's')
		}
	default:
		defaultFormat(string(st), f, c)
	}
}
738035
func (s *Trace) Format(state fmt.State, verb rune) {
	if s != nil {
		for _, el := range *s {
			fmt.Fprintf(state, "%s:%s in %s line %d", el.PackageName, el.MethodName, el.FileName, el.LineNumber)
		}
	}
}
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
}
3622
func (f *flatFormatter) Format(format string, args ...interface{}) (n int, errno error) {
	return (*indentFormatter)(f).format(true, format, args...)
}
1120711
func (f *TextFormatter) Format(entry *logrus.Entry) ([]byte, error) {
	var b *bytes.Buffer

	// if you aren't calling WithField(s), len(keys) will probably be 0
	keys := make([]string, 0, len(entry.Data))
	for k := range entry.Data {
		keys = append(keys, k)
	}
	lastKeyIdx := len(keys) - 1

	if !f.DisableSorting {
		sort.Strings(keys)
	}

	// retrieve existing buffer if possible
	if entry.Buffer != nil {
		b = entry.Buffer
	} else {
		b = &bytes.Buffer{}
	}

	timestampFormat := f.TimestampFormat
	if timestampFormat == "" {
		timestampFormat = defaultTimestampFormat
	}

	f.Do(func() { f.init(entry) })

	if !f.DisableTimestamp {
		b.WriteString(entry.Time.Format(timestampFormat))
		b.WriteByte(' ')
	}

	// if you don't want brackets around the log level you can remove them here
	b.WriteByte('[')
	if !f.DisableUppercase {
		b.WriteString(strings.ToUpper(entry.Level.String()))
	} else {
		b.WriteString(entry.Level.String())
	}
	b.WriteByte(']')
	b.WriteByte(' ')

	// if you don't want brackets around the module name you can remove them here
	if f.ModuleName != "" {
		b.WriteByte('[')
		b.WriteString(f.ModuleName)
		b.WriteByte(']')
		b.WriteByte(' ')
	}

	// even without a message, it will still log the other information
	if entry.Message != "" {
		b.WriteString(entry.Message)
		if lastKeyIdx >= 0 {
			b.WriteByte(' ')
		}
	}

	// again, this really only applies when using WithField(s)
	for i, key := range keys {
		f.appendKeyValue(b, key, entry.Data[key], lastKeyIdx != i)
	}

	b.WriteByte('\n')
	return b.Bytes(), nil
}
267771
func (f *Formatter) Format(amount int64) string {
	// Work with absolute amount value
	sa := strconv.FormatInt(f.abs(amount), 10)

	if len(sa) <= f.Fraction {
		sa = strings.Repeat("0", f.Fraction-len(sa)+1) + sa
	}

	if f.Thousand != "" {
		for i := len(sa) - f.Fraction - 3; i > 0; i -= 3 {
			sa = sa[:i] + f.Thousand + sa[i:]
		}
	}

	if f.Fraction > 0 {
		sa = sa[:len(sa)-f.Fraction] + f.Decimal + sa[len(sa)-f.Fraction:]
	}
	sa = strings.Replace(f.Template, "1", sa, 1)
	sa = strings.Replace(sa, "$", f.Grapheme, 1)

	// Add minus sign for negative amount.
	if amount < 0 {
		sa = "-" + sa
	}

	return sa
}
397749
func (s *IndicesAnalyzeService) Format(format string) *IndicesAnalyzeService {
	s.format = format
	return s
}
936021
func (a Address) Format(s fmt.State, c rune) {
	fmt.Fprintf(s, "%"+string(c), a[:])
}
247329
func (sc *StringConstraint) Format(f string) *StringConstraint {
	sc.format = f
	return sc
}
703291
func (f *Strftime) Format(dst io.Writer, t time.Time) error {
	const bufSize = 64
	var b []byte
	max := len(f.pattern) + 10
	if max < bufSize {
		var buf [bufSize]byte
		b = buf[:0]
	} else {
		b = make([]byte, 0, max)
	}
	if _, err := dst.Write(f.format(b, t)); err != nil {
		return err
	}
	return nil
}
1347188
func (f *PoliteJSONFormatter) Format(calldepth int, r *logging.Record, w io.Writer) error {
	entry := make(map[string]interface{})
	entry["id"] = r.Id
	entry["level"] = r.Level
	entry["time"] = r.Time
	entry["module"] = r.Module
	entry["message"] = r.Message()
	err := json.NewEncoder(w).Encode(entry)
	if err != nil {
		return err
	}

	w.Write([]byte{'\n'})
	return nil
}