+
+// durationText returns d for a log line: rounded to the second, or to the
+// millisecond when it is shorter than a second.
+func durationText(d time.Duration) string {
+ if d < time.Second {
+ return d.Round(time.Millisecond).String()
+ }
+
+ return d.Round(time.Second).String()
+}