// Returns a string visualization of the entry
162064
func (e HashEntry) String() string {
	return fmt.Sprintf("HashEntry{Key: %s, Value: %s}", DataToString(e.Key), DataToString(e.Value))
}
355899
func (entry *Entry) Println(args ...interface{}) {
	if entry.lgEntry.Logger.Level >= lg.InfoLevel {
		entry.lgEntry.WithFields(entry.fields).Println(entry.sprintlnn(args...))
	}
}
40710
func (e *IndexEntry) String() string {
	return fmt.Sprintf("min=%s max=%s ofs=%d siz=%d",
		time.Unix(0, e.MinTime).UTC(), time.Unix(0, e.MaxTime).UTC(), e.Offset, e.Size)
}
713864
func (n Name) String() string {
	s, _, _ := n.Display()
	return s
}
971103
func (jf *JSONFormatter) LogEntry(level int, msg string, args []interface{}) map[string]interface{} {
	buf := pool.Get()
	defer pool.Put(buf)
	jf.Format(buf, level, msg, args)
	var entry map[string]interface{}
	err := json.Unmarshal(buf.Bytes(), &entry)
	if err != nil {
		panic("Unable to unmarhsal entry from JSONFormatter: " + err.Error() + " \"" + string(buf.Bytes()) + "\"")
	}
	return entry
}
737382
func (u *UI) ColorString(c Color, s string) string {
	if !u.EnableColors {
		return s
	}

	ctx := ansiterm.Context{
		Foreground: ansiterm.Color(c),
	}

	return createStyledString(ctx, s)
}
344974
func Prettify(i interface{}) string {
	var buf bytes.Buffer
	prettify(reflect.ValueOf(i), 0, &buf)
	return buf.String()
}
7272
func (c *Console) Log(e log.Entry) {

	var b []byte
	var lvl string
	var i int

	if c.displayColor {
		color := c.colors[e.Level]

		b = append(b, e.Timestamp.Format(c.timestampFormat)...)
		b = append(b, space)
		b = append(b, color...)

		lvl = e.Level.String()

		for i = 0; i < 6-len(lvl); i++ {
			b = append(b, space)
		}
		b = append(b, lvl...)
		b = append(b, ansi.Reset...)
		b = append(b, space)
		b = append(b, e.Message...)

		for _, f := range e.Fields {
			b = append(b, space)
			b = append(b, color...)
			b = append(b, f.Key...)
			b = append(b, ansi.Reset...)
			b = append(b, equals)

			switch t := f.Value.(type) {
			case string:
				b = append(b, t...)
			case int:
				b = strconv.AppendInt(b, int64(t), base10)
			case int8:
				b = strconv.AppendInt(b, int64(t), base10)
			case int16:
				b = strconv.AppendInt(b, int64(t), base10)
			case int32:
				b = strconv.AppendInt(b, int64(t), base10)
			case int64:
				b = strconv.AppendInt(b, t, base10)
			case uint:
				b = strconv.AppendUint(b, uint64(t), base10)
			case uint8:
				b = strconv.AppendUint(b, uint64(t), base10)
			case uint16:
				b = strconv.AppendUint(b, uint64(t), base10)
			case uint32:
				b = strconv.AppendUint(b, uint64(t), base10)
			case uint64:
				b = strconv.AppendUint(b, t, base10)
			case float32:
				b = strconv.AppendFloat(b, float64(t), 'f', -1, 32)
			case float64:
				b = strconv.AppendFloat(b, t, 'f', -1, 64)
			case bool:
				b = strconv.AppendBool(b, t)
			default:
				b = append(b, fmt.Sprintf(v, f.Value)...)
			}
		}

		b = append(b, newLine)
	} else {
		b = append(b, e.Timestamp.Format(c.timestampFormat)...)
		b = append(b, space)

		lvl = e.Level.String()

		for i = 0; i < 6-len(lvl); i++ {
			b = append(b, space)
		}

		b = append(b, lvl...)
		b = append(b, space)
		b = append(b, e.Message...)

		for _, f := range e.Fields {
			b = append(b, space)
			b = append(b, f.Key...)
			b = append(b, equals)

			switch t := f.Value.(type) {
			case string:
				b = append(b, t...)
			case int:
				b = strconv.AppendInt(b, int64(t), base10)
			case int8:
				b = strconv.AppendInt(b, int64(t), base10)
			case int16:
				b = strconv.AppendInt(b, int64(t), base10)
			case int32:
				b = strconv.AppendInt(b, int64(t), base10)
			case int64:
				b = strconv.AppendInt(b, t, base10)
			case uint:
				b = strconv.AppendUint(b, uint64(t), base10)
			case uint8:
				b = strconv.AppendUint(b, uint64(t), base10)
			case uint16:
				b = strconv.AppendUint(b, uint64(t), base10)
			case uint32:
				b = strconv.AppendUint(b, uint64(t), base10)
			case uint64:
				b = strconv.AppendUint(b, t, base10)
			case float32:
				b = strconv.AppendFloat(b, float64(t), 'f', -1, 32)
			case float64:
				b = strconv.AppendFloat(b, t, 'f', -1, 64)
			case bool:
				b = strconv.AppendBool(b, t)
			default:
				b = append(b, fmt.Sprintf(v, f.Value)...)
			}
		}

		b = append(b, newLine)
	}
	_, _ = c.writer.Write(b)
}
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
}
415329
func (doc leaseDoc) entry() (string, entry, error) {
	if err := doc.validate(); err != nil {
		return "", entry{}, errors.Trace(err)
	}
	entry := entry{
		holder:   doc.Holder,
		start:    toTime(doc.Start),
		duration: doc.Duration,
		writer:   doc.Writer,
	}
	return doc.Name, entry, nil
}
245379
func (e *Entry) String() string {
	switch e.SetType {
	case HashIPPort:
		// Entry{192.168.1.1, udp, 53} -> 192.168.1.1,udp:53
		// Entry{192.168.1.2, tcp, 8080} -> 192.168.1.2,tcp:8080
		return fmt.Sprintf("%s,%s:%s", e.IP, e.Protocol, strconv.Itoa(e.Port))
	case HashIPPortIP:
		// Entry{192.168.1.1, udp, 53, 10.0.0.1} -> 192.168.1.1,udp:53,10.0.0.1
		// Entry{192.168.1.2, tcp, 8080, 192.168.1.2} -> 192.168.1.2,tcp:8080,192.168.1.2
		return fmt.Sprintf("%s,%s:%s,%s", e.IP, e.Protocol, strconv.Itoa(e.Port), e.IP2)
	case HashIPPortNet:
		// Entry{192.168.1.2, udp, 80, 10.0.1.0/24} -> 192.168.1.2,udp:80,10.0.1.0/24
		// Entry{192.168.2,25, tcp, 8080, 10.1.0.0/16} -> 192.168.2,25,tcp:8080,10.1.0.0/16
		return fmt.Sprintf("%s,%s:%s,%s", e.IP, e.Protocol, strconv.Itoa(e.Port), e.Net)
	case BitmapPort:
		// Entry{53} -> 53
		// Entry{8080} -> 8080
		return strconv.Itoa(e.Port)
	}
	return ""
}
290033
func (de *decoder) mapEntry(slval reflect.Value, vb []byte) error {
	mKey := reflect.New(slval.Type().Key())
	mVal := reflect.New(slval.Type().Elem())
	k := mKey.Elem()
	v := mVal.Elem()
	key, n := binary.Uvarint(vb)
	if n <= 0 {
		return errors.New("bad protobuf field key")
	}
	buf := vb[n:]
	wiretype := int(key & 7)

	var err error
	buf, err = de.value(wiretype, buf, k)
	if err != nil {
		return err
	}
	for len(buf) > 0 { // for repeated values (slices etc)
		key, n = binary.Uvarint(buf)
		if n <= 0 {
			return errors.New("bad protobuf field key")
		}
		buf = buf[n:]
		wiretype = int(key & 7)
		buf, err = de.value(wiretype, buf, v)
		if err != nil {
			return err
		}
	}

	if !k.IsValid() || !v.IsValid() {
		// We did not decode the key or the value in the map entry.
		// Either way, it's an invalid map entry.
		return errors.New("proto: bad map data: missing key/val")
	}
	slval.SetMapIndex(k, v)

	return nil
}
565805
func (e SortedSetEntry) String() string {
	return fmt.Sprintf("SortedSetEntry{Value: %s, Score: %0.4f}", DataToString(e.Value), e.Score)
}
900567
func (i HintMetrics) String() string {
	switch i {
	case HintMetricsDefault:
		return "HintMetricsDefault"
	case HintMetricsOff:
		return "HintMetricsOff"
	case HintMetricsOn:
		return "HintMetricsOn"
	default:
		return fmt.Sprintf("HintMetrics(%d)", i)
	}
}
123635
func (a *App) String() string {
	img := a.Name.String()
	for n, v := range a.Labels {
		img += fmt.Sprintf(",%s=%s", n, v)
	}
	return img
}
845804
func (s Style) String() string {
	if s.IsZero() {
		return "{}"
	}

	var output []string
	if s.Show {
		output = []string{"\"show\": true"}
	} else {
		output = []string{"\"show\": false"}
	}

	if s.ClassName != "" {
		output = append(output, fmt.Sprintf("\"class_name\": %s", s.ClassName))
	} else {
		output = append(output, "\"class_name\": null")
	}

	if !s.Padding.IsZero() {
		output = append(output, fmt.Sprintf("\"padding\": %s", s.Padding.String()))
	} else {
		output = append(output, "\"padding\": null")
	}

	if s.StrokeWidth >= 0 {
		output = append(output, fmt.Sprintf("\"stroke_width\": %0.2f", s.StrokeWidth))
	} else {
		output = append(output, "\"stroke_width\": null")
	}

	if !s.StrokeColor.IsZero() {
		output = append(output, fmt.Sprintf("\"stroke_color\": %s", s.StrokeColor.String()))
	} else {
		output = append(output, "\"stroke_color\": null")
	}

	if len(s.StrokeDashArray) > 0 {
		var elements []string
		for _, v := range s.StrokeDashArray {
			elements = append(elements, fmt.Sprintf("%.2f", v))
		}
		dashArray := strings.Join(elements, ", ")
		output = append(output, fmt.Sprintf("\"stroke_dash_array\": [%s]", dashArray))
	} else {
		output = append(output, "\"stroke_dash_array\": null")
	}

	if s.DotWidth >= 0 {
		output = append(output, fmt.Sprintf("\"dot_width\": %0.2f", s.DotWidth))
	} else {
		output = append(output, "\"dot_width\": null")
	}

	if !s.DotColor.IsZero() {
		output = append(output, fmt.Sprintf("\"dot_color\": %s", s.DotColor.String()))
	} else {
		output = append(output, "\"dot_color\": null")
	}

	if !s.FillColor.IsZero() {
		output = append(output, fmt.Sprintf("\"fill_color\": %s", s.FillColor.String()))
	} else {
		output = append(output, "\"fill_color\": null")
	}

	if s.FontSize != 0 {
		output = append(output, fmt.Sprintf("\"font_size\": \"%0.2fpt\"", s.FontSize))
	} else {
		output = append(output, "\"font_size\": null")
	}

	if !s.FontColor.IsZero() {
		output = append(output, fmt.Sprintf("\"font_color\": %s", s.FontColor.String()))
	} else {
		output = append(output, "\"font_color\": null")
	}

	if s.Font != nil {
		output = append(output, fmt.Sprintf("\"font\": \"%s\"", s.Font.Name(truetype.NameIDFontFamily)))
	} else {
		output = append(output, "\"font_color\": null")
	}

	return "{" + strings.Join(output, ", ") + "}"
}
623028
func getMetaDataEntry(metadataString string) (map[string]string, *probe.Error) {
	metaDataMap := make(map[string]string)
	for _, metaData := range strings.Split(metadataString, ",") {
		metaDataEntry := strings.Split(metaData, "=")
		if len(metaDataEntry) == 2 {
			metaDataMap[metaDataEntry[0]] = metaDataEntry[1]
		} else {
			return nil, probe.NewError(ErrInvalidMetadata)
		}
	}
	return metaDataMap, nil
}