Does this issue reproduce with the latest release?
Yes
What did you do?
package main
import"log"funcmain() {
log.Println("Hello, world.")
}
What did you expect to see?
2021-12-15 19:12:34 Hello, world.
To clarify, I'd be fine with this being configurable via a flag (i.e. log.SetFlags(log.LstdFlags | log.LdateHyphenSeparator) where log.LdateHyphenSeparator would be a new flag) for the sake of backward compatibility.
What did you see instead?
2021/12/15 19:12:34 Hello, world.
Explanation
This has been one of my biggest pet peeve -- as petty as it sounds. I've considered using a different logging libraries, but the truth is, all I want is this feature in the standard library.
Let me explain myself.
I find the date in the following logs:
2021/12/15 19:39:13 Listening on :80802021/12/15 19:39:15 Received termination signal, attempting to gracefully shut down2021/12/15 19:39:15 http: Server closed2021/12/15 19:39:15 Shutting down janitor 2021/12/15 19:39:16 Shutting down
significantly more distracting than this:
2021-12-15 19:39:13 Listening on :80802021-12-15 19:39:15 Received termination signal, attempting to gracefully shut down2021-12-15 19:39:15 http: Server closed2021-12-15 19:39:15 Shutting down janitor 2021-12-15 19:39:16 Shutting down
I find it easier to read because - doesn't leave the ambiguity that / does with 1 and 7, and after having used Go for a long time and scrolling through millions of lines of logs, ambiguity or not, / makes my eyes pause for slightly longer than - would.
Furthermore, the separator for time is also :, which, like -, has a much smaller max character height than /, making it less visually distracting.
Making the change is extremely trivial -- I don't mind taking care of it, in fact, I'd love to -- but I'd like to know if there are any objections to it. From what I've seen, the log package is extremely barebone, and rightfully so, but I really think that in term of UX, having an easier-to-read date format in the standard library log package would go a long way.
FWIW, if I was the only person impacted, I would have wanted the package to use - as the date separator by default, alas, this would surely break more than one libraries.
Relevant
#6095: Unlike this issue, I actually think that having the timestamp follow ISO8601 would make the whole timestamp even less readable. All I'm interested in is adding a flag to use - instead of / for the date.
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
log: Add flag to use hyphen instead of slash as separator
proposal: log: add flag to use hyphen instead of slash as separator
Dec 16, 2021
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
What did you expect to see?
2021-12-15 19:12:34 Hello, world.
To clarify, I'd be fine with this being configurable via a flag (i.e.
log.SetFlags(log.LstdFlags | log.LdateHyphenSeparator)
wherelog.LdateHyphenSeparator
would be a new flag) for the sake of backward compatibility.What did you see instead?
2021/12/15 19:12:34 Hello, world.
Explanation
This has been one of my biggest pet peeve -- as petty as it sounds. I've considered using a different logging libraries, but the truth is, all I want is this feature in the standard library.
Let me explain myself.
I find the date in the following logs:
significantly more distracting than this:
I find it easier to read because
-
doesn't leave the ambiguity that/
does with1
and7
, and after having used Go for a long time and scrolling through millions of lines of logs, ambiguity or not,/
makes my eyes pause for slightly longer than-
would.Furthermore, the separator for time is also
:
, which, like-
, has a much smaller max character height than/
, making it less visually distracting.Making the change is extremely trivial -- I don't mind taking care of it, in fact, I'd love to -- but I'd like to know if there are any objections to it. From what I've seen, the
log
package is extremely barebone, and rightfully so, but I really think that in term of UX, having an easier-to-read date format in the standard library log package would go a long way.FWIW, if I was the only person impacted, I would have wanted the package to use
-
as the date separator by default, alas, this would surely break more than one libraries.Relevant
#6095: Unlike this issue, I actually think that having the timestamp follow ISO8601 would make the whole timestamp even less readable. All I'm interested in is adding a flag to use
-
instead of/
for the date.The text was updated successfully, but these errors were encountered: