Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log: Colon missing from standard format log messages. #9448

Closed
lparkes opened this issue Dec 26, 2014 · 3 comments
Closed

log: Colon missing from standard format log messages. #9448

lparkes opened this issue Dec 26, 2014 · 3 comments

Comments

@lparkes
Copy link

lparkes commented Dec 26, 2014

The documentation for the log packages states that the flag controlled items printed out in each log message are always followed by a colon, but this only seems to be the case if the flags Llongfile or Lshortfile are specified.

  1. What version of Go are you using (go version)?
    castigate:~ lloyd$ go version
    go version go1.4 darwin/amd64

  2. What operating system and processor architecture are you using?
    castigate:~ lloyd$ uname -a
    Darwin castigate.must-have-coffee.gen.nz 13.4.0 Darwin Kernel Version 13.4.0: Wed Dec 24 20:21:41 NZDT 201; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64

  3. What did you do?
    I generated a log message with the standard flags. See
    http://play.golang.org/p/uiXXdDvlaJ

  4. What did you expect to see?
    I expect to see a colon after the datestamp as described in the comment for the flag constants at http://golang.org/pkg/log/#pkg-constants. "A colon appears after these items"
    I expect the output to be "logger: 2009/11/10 23:00:00: Hello, log file!"

  5. What did you see instead?
    I get "logger: 2009/11/10 23:00:00 Hello, log file!" instead.

@mikioh mikioh changed the title Colon missing from standard format log messages. log: Colon missing from standard format log messages. Dec 26, 2014
@adg
Copy link
Contributor

adg commented Dec 28, 2014

I'm not sure that we should change the behaviour now, as people might be parsing the log output and it would be rude to change it under them.

Perhaps the comment should be updated? I suspect @robpike wrote it in the first place. Rob?

@lparkes
Copy link
Author

lparkes commented Dec 29, 2014

On 29/12/2014, at 12:21 pm, Andrew Gerrand notifications@github.com wrote:

I'm not sure that we should change the behaviour now, as people might be parsing the log output and it would be rude to change it under them.

One might argue that people who have written parsers to handle the undocumented behaviour without reporting the discrepancy between the code and the documentation deserve to have the code fixed under them ;-)
Perhaps the comment should be updated? I suspect @robpike wrote it in the first place. Rob?

I must confess that I’m not really worried whether the code of the doco gets fixed. It’d just be nice if one of them got fixed. Adding a colon to the end of the timestamp makes it look ugly, but a variable message format is also ugly, so I’m not going to call either fix “obviously correct”.

Cheers,
Lloyd

@adg
Copy link
Contributor

adg commented Dec 30, 2014

Just sent https://go-review.googlesource.com/2088 to update the doc comment

On 30 December 2014 at 06:24, lparkes notifications@github.com wrote:

On 29/12/2014, at 12:21 pm, Andrew Gerrand notifications@github.com
wrote:

I'm not sure that we should change the behaviour now, as people might be
parsing the log output and it would be rude to change it under them.

One might argue that people who have written parsers to handle the
undocumented behaviour without reporting the discrepancy between the code
and the documentation deserve to have the code fixed under them ;-)
Perhaps the comment should be updated? I suspect @robpike wrote it in
the first place. Rob?

I must confess that I’m not really worried whether the code of the doco
gets fixed. It’d just be nice if one of them got fixed. Adding a colon to
the end of the timestamp makes it look ugly, but a variable message format
is also ugly, so I’m not going to call either fix “obviously correct”.

Cheers,
Lloyd


Reply to this email directly or view it on GitHub
#9448 (comment).

@adg adg closed this as completed in 43ce5c0 Jan 5, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants