summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-01-03 10:34:06 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-01-05 19:48:17 -0700
commitdf62eb5d4c92756914ce57a1b6219b39876331f6 (patch)
treeeacfd2c70bb085f9446ce0d6c6db5a8a77631ac4
parent39dfaa5af4b628eee55b4aa583abf72ef5833f32 (diff)
Try to get log-lines to be shorter
-rw-r--r--lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go3
-rw-r--r--lib/textui/log.go3
-rw-r--r--lib/textui/log_test.go2
3 files changed, 5 insertions, 3 deletions
diff --git a/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go b/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go
index 80db817..63a0d16 100644
--- a/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go
+++ b/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go
@@ -109,7 +109,8 @@ type itemStats struct {
}
func (s itemStats) String() string {
- return textui.Sprintf("%v (queued %v augments and %v failures across %v trees)",
+ // return textui.Sprintf("%v (queued %v augments and %v failures across %v trees)",
+ return textui.Sprintf("%v (aug:%v fail:%v trees:%v)",
s.Portion, s.NumAugments, s.NumFailures, s.NumAugmentTrees)
}
diff --git a/lib/textui/log.go b/lib/textui/log.go
index 8327b67..110e1aa 100644
--- a/lib/textui/log.go
+++ b/lib/textui/log.go
@@ -180,7 +180,7 @@ func (l *logger) log(lvl dlog.LogLevel, writeMsg func(io.Writer)) {
// time ////////////////////////////////////////////////////////////////
now := time.Now()
- const timeFmt = "2006-01-02 15:04:05.0000"
+ const timeFmt = "15:04:05.0000"
logBuf.WriteString(timeFmt)
now.AppendFormat(logBuf.Bytes()[:0], timeFmt)
@@ -372,6 +372,7 @@ func writeField(w io.Writer, key string, val any) {
if strings.HasPrefix(valStr, "/main/") {
valStr = strings.TrimPrefix(valStr, "/main")
}
+ valStr = strings.TrimPrefix(valStr, "/")
}
case strings.HasSuffix(name, ".pass"):
fmt.Fprintf(w, "/pass-%s", valStr)
diff --git a/lib/textui/log_test.go b/lib/textui/log_test.go
index 514d96e..bcd9c39 100644
--- a/lib/textui/log_test.go
+++ b/lib/textui/log_test.go
@@ -16,7 +16,7 @@ import (
)
func logLineRegexp(inner string) string {
- return `[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{4} ` + inner + ` \(from lib/textui/log_test\.go:[0-9]+\)\n`
+ return `[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{4} ` + inner + ` \(from lib/textui/log_test\.go:[0-9]+\)\n`
}
func TestLogFormat(t *testing.T) {