mirror of
https://github.com/weaveworks/scope.git
synced 2026-02-14 18:09:59 +00:00
Less verbose string dump of LatestMap
The default time.Time.String() includes nanoseconds, wall-clock adjustment, etc. Also don't include the key twice when stringizing the map itself.
This commit is contained in:
@@ -53,7 +53,7 @@ function generate_latest_map() {
|
||||
|
||||
// String returns the StringLatestEntry's string representation.
|
||||
func (e *${entry_type}) String() string {
|
||||
return fmt.Sprintf("%v (%s)", e.Value, e.Timestamp.String())
|
||||
return fmt.Sprintf("%v (%s)", e.Value, e.Timestamp.Format(time.RFC3339))
|
||||
}
|
||||
|
||||
// Equal returns true if the supplied StringLatestEntry is equal to this one.
|
||||
@@ -181,7 +181,7 @@ function generate_latest_map() {
|
||||
func (m ${latest_map_type}) String() string {
|
||||
buf := bytes.NewBufferString("{")
|
||||
for _, val := range m {
|
||||
fmt.Fprintf(buf, "%s: %v,\n", val.key, val)
|
||||
fmt.Fprintf(buf, "%s: %s,\n", val.key, val.String())
|
||||
}
|
||||
fmt.Fprintf(buf, "}")
|
||||
return buf.String()
|
||||
|
||||
@@ -21,7 +21,7 @@ type stringLatestEntry struct {
|
||||
|
||||
// String returns the StringLatestEntry's string representation.
|
||||
func (e *stringLatestEntry) String() string {
|
||||
return fmt.Sprintf("%v (%s)", e.Value, e.Timestamp.String())
|
||||
return fmt.Sprintf("%v (%s)", e.Value, e.Timestamp.Format(time.RFC3339))
|
||||
}
|
||||
|
||||
// Equal returns true if the supplied StringLatestEntry is equal to this one.
|
||||
@@ -149,7 +149,7 @@ func (m StringLatestMap) ForEach(fn func(k string, timestamp time.Time, v string
|
||||
func (m StringLatestMap) String() string {
|
||||
buf := bytes.NewBufferString("{")
|
||||
for _, val := range m {
|
||||
fmt.Fprintf(buf, "%s: %v,\n", val.key, val)
|
||||
fmt.Fprintf(buf, "%s: %s,\n", val.key, val.String())
|
||||
}
|
||||
fmt.Fprintf(buf, "}")
|
||||
return buf.String()
|
||||
@@ -243,7 +243,7 @@ type nodeControlDataLatestEntry struct {
|
||||
|
||||
// String returns the StringLatestEntry's string representation.
|
||||
func (e *nodeControlDataLatestEntry) String() string {
|
||||
return fmt.Sprintf("%v (%s)", e.Value, e.Timestamp.String())
|
||||
return fmt.Sprintf("%v (%s)", e.Value, e.Timestamp.Format(time.RFC3339))
|
||||
}
|
||||
|
||||
// Equal returns true if the supplied StringLatestEntry is equal to this one.
|
||||
@@ -371,7 +371,7 @@ func (m NodeControlDataLatestMap) ForEach(fn func(k string, timestamp time.Time,
|
||||
func (m NodeControlDataLatestMap) String() string {
|
||||
buf := bytes.NewBufferString("{")
|
||||
for _, val := range m {
|
||||
fmt.Fprintf(buf, "%s: %v,\n", val.key, val)
|
||||
fmt.Fprintf(buf, "%s: %s,\n", val.key, val.String())
|
||||
}
|
||||
fmt.Fprintf(buf, "}")
|
||||
return buf.String()
|
||||
|
||||
Reference in New Issue
Block a user