// format formats the bytes of a point for debugging.
436670
func (p *Point) format() string {
	if p.X == nil && p.Y == nil {
		return "(inf,inf)"
	}
	return fmt.Sprintf("(%s,%s)", hex.EncodeToString(p.X.Bytes()), hex.EncodeToString(p.Y.Bytes()))
}
59048
func (node *OrExpr) Format(buf *TrackedBuffer) {
	buf.Myprintf("%v or %v", node.Left, node.Right)
}
1220927
func (cf *colorizingFormatter) Format(entry *logrus.Entry) ([]byte, error) {
	data := make(logrus.Fields, len(entry.Data)+3)
	for k, v := range entry.Data {
		switch v := v.(type) {
		case error:
			// Otherwise errors are ignored by `encoding/json`
			// https://github.com/sirupsen/logrus/issues/137
			data[k] = v.Error()
		default:
			data[k] = v
		}
	}
	timestampFormat := cf.TimestampFormat
	if timestampFormat == "" {
		timestampFormat = time.RFC3339
	}
	if !cf.DisableTimestamp {
		data[logrus.FieldKeyTime] = entry.Time.Format(timestampFormat)
	}
	data[logrus.FieldKeyMsg] = entry.Message
	data[logrus.FieldKeyLevel] = entry.Level.String()
	prettyString, prettyStringErr := prettyjson.Marshal(data)
	if prettyStringErr != nil {
		return nil, errors.Wrapf(prettyStringErr, "Failed to marshal fields to JSON")
	}
	return append(prettyString, '\n'), nil
}
415783
func (node *SQLVal) Format(buf *TrackedBuffer) {
	switch node.Type {
	case StrVal:
		sqltypes.MakeTrusted(sqltypes.VarBinary, node.Val).EncodeSQL(buf)
	case IntVal, FloatVal, HexNum:
		buf.Myprintf("%s", []byte(node.Val))
	case HexVal:
		buf.Myprintf("X'%s'", []byte(node.Val))
	case BitVal:
		buf.Myprintf("B'%s'", []byte(node.Val))
	case ValArg:
		buf.WriteArg(string(node.Val))
	default:
		panic("unexpected")
	}
}
41216
func (f *indentFormatter) Format(format string, args ...interface{}) (n int, errno error) {
	return f.format(false, format, args...)
}
98532
func (timeCache *timeFormatCacheType) Format() []byte {
	timeCache.lock.RLock()
	defer timeCache.lock.RUnlock()

	return timeCache.format
}
936021
func (a Address) Format(s fmt.State, c rune) {
	fmt.Fprintf(s, "%"+string(c), a[:])
}
198908
func (node *When) Format(buf *TrackedBuffer) {
	buf.Myprintf("when %v then %v", node.Cond, node.Val)
}
780323
func (node *Use) Format(buf *TrackedBuffer) {
	if node.DBName.v != "" {
		buf.Myprintf("use %v", node.DBName)
	} else {
		buf.Myprintf("use")
	}
}
1090665
func (node *JoinTableExpr) Format(buf *TrackedBuffer) {
	buf.Myprintf("%v %s %v%v", node.LeftExpr, node.Join, node.RightExpr, node.Condition)
}
900907
func (r PinVerifyRes) Format(out io.Writer) {
	if r.Ok {
		fmt.Fprintf(out, "%s ok\n", r.Cid)
	} else {
		fmt.Fprintf(out, "%s broken\n", r.Cid)
		for _, e := range r.BadNodes {
			fmt.Fprintf(out, "  %s: %s\n", e.Cid, e.Err)
		}
	}
}
621691
func (hd *HappyDevFormatter) Format(writer io.Writer, level int, msg string, args []interface{}) {
	buf := pool.Get()
	defer pool.Put(buf)

	if len(args) == 1 {
		args = append(args, 0)
		copy(args[1:], args[0:])
		args[0] = singleArgKey
	}

	// warn about reserved, bad and complex keys
	for i := 0; i < len(args); i += 2 {
		isReserved, err := isReservedKey(args[i])
		if err != nil {
			InternalLog.Error("Key is not a string.", "err", fmt.Errorf("args[%d]=%v", i, args[i]))
		} else if isReserved {
			InternalLog.Fatal("Key conflicts with reserved key. Avoiding using single rune keys.", "key", args[i].(string))
		} else {
			// Ensure keys are simple strings. The JSONFormatter doesn't escape
			// keys as a performance tradeoff. This panics if the JSON key
			// value has a different value than a simple quoted string.
			key := args[i].(string)
			b, err := json.Marshal(key)
			if err != nil {
				panic("Key is invalid. " + err.Error())
			}
			if string(b) != `"`+key+`"` {
				panic("Key is complex. Use simpler key for: " + fmt.Sprintf("%q", key))
			}
		}
	}

	// use the production JSON formatter to format the log first. This
	// ensures JSON will marshal/unmarshal correctly in production.
	entry := hd.jsonFormatter.LogEntry(level, msg, args)

	// reset the column tracker used for fancy formatting
	hd.col = 0

	// timestamp
	buf.WriteString(theme.Misc)
	hd.writeString(buf, entry[KeyMap.Time].(string))
	if !disableColors {
		buf.WriteString(ansi.Reset)
	}

	// emphasize warnings and errors
	message, context, color := hd.getLevelContext(level, entry)
	if message == "" {
		message = entry[KeyMap.Message].(string)
	}

	// DBG, INF ...
	hd.set(buf, "", entry[KeyMap.Level].(string), color)
	// logger name
	hd.set(buf, "", entry[KeyMap.Name], theme.Misc)
	// message from user
	hd.set(buf, "", message, theme.Message)

	// Preserve key order in the sequencethey were added by developer.This
	// makes it easier for developers to follow the log.
	order := []string{}
	lenArgs := len(args)
	for i := 0; i < len(args); i += 2 {
		if i+1 >= lenArgs {
			continue
		}
		if key, ok := args[i].(string); ok {
			order = append(order, key)
		} else {
			order = append(order, badKeyAtIndex(i))
		}
	}

	for _, key := range order {
		// skip reserved keys which were already added to buffer above
		isReserved, err := isReservedKey(key)
		if err != nil {
			panic("key is invalid. Should never get here. " + err.Error())
		} else if isReserved {
			continue
		}
		hd.set(buf, key, entry[key], theme.Value)
	}

	addLF := true
	hasCallStack := entry[KeyMap.CallStack] != nil
	// WRN,ERR file, line number context

	if context != "" {
		// warnings and traces are single line, space can be optimized
		if level == LevelTrace || (level == LevelWarn && !hasCallStack) {
			// gets rid of "in "
			idx := strings.IndexRune(context, 'n')
			hd.set(buf, "in", context[idx+2:], color)
		} else {
			buf.WriteRune('\n')
			if !disableColors {
				buf.WriteString(color)
			}
			addLF = context[len(context)-1:len(context)] != "\n"
			buf.WriteString(context)
			if !disableColors {
				buf.WriteString(ansi.Reset)
			}
		}
	} else if hasCallStack {
		hd.set(buf, "", entry[KeyMap.CallStack], color)
	}
	if addLF {
		buf.WriteRune('\n')
	}
	buf.WriteTo(writer)
}
1367037
func (node *IsExpr) Format(buf *TrackedBuffer) {
	buf.Myprintf("%v %s", node.Expr, node.Operator)
}
149368
func (a *MovFnAggregation) Format(format string) *MovFnAggregation {
	a.format = format
	return a
}
1217328
func (node *Where) Format(buf *TrackedBuffer) {
	if node == nil || node.Expr == nil {
		return
	}
	buf.Myprintf(" %s %v", node.Type, node.Expr)
}
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
}
397749
func (s *IndicesAnalyzeService) Format(format string) *IndicesAnalyzeService {
	s.format = format
	return s
}