diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-01-03 10:34:06 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-01-05 19:48:17 -0700 |
commit | df62eb5d4c92756914ce57a1b6219b39876331f6 (patch) | |
tree | eacfd2c70bb085f9446ce0d6c6db5a8a77631ac4 /lib/textui | |
parent | 39dfaa5af4b628eee55b4aa583abf72ef5833f32 (diff) |
Try to get log-lines to be shorter
Diffstat (limited to 'lib/textui')
-rw-r--r-- | lib/textui/log.go | 3 | ||||
-rw-r--r-- | lib/textui/log_test.go | 2 |
2 files changed, 3 insertions, 2 deletions
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) { |