Fix trailing space with only .Date log option

This commit is contained in:
Feoramund
2024-05-23 16:29:18 -04:00
parent 8ae375dbff
commit 7d4da6eaa7

View File

@@ -123,7 +123,12 @@ do_time_header :: proc(opts: Options, buf: ^strings.Builder, t: time.Time) {
fmt.sbprint(buf, "[")
y, m, d := time.date(t)
h, min, s := time.clock(t)
if .Date in opts { fmt.sbprintf(buf, "%d-%02d-%02d ", y, m, d) }
if .Date in opts {
fmt.sbprintf(buf, "%d-%02d-%02d", y, m, d)
if .Time in opts {
fmt.sbprint(buf, " ")
}
}
if .Time in opts { fmt.sbprintf(buf, "%02d:%02d:%02d", h, min, s) }
fmt.sbprint(buf, "] ")
}