-
Notifications
You must be signed in to change notification settings - Fork 357
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 datetime #2191
base: master
Are you sure you want to change the base?
Log datetime #2191
Conversation
src/command/PlayerCommands.cxx
Outdated
@@ -129,7 +129,7 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r) | |||
COMMAND_STATUS_PLAYLIST ": {}\n" | |||
COMMAND_STATUS_PLAYLIST_LENGTH ": {}\n" | |||
COMMAND_STATUS_MIXRAMPDB ": {}\n" | |||
COMMAND_STATUS_STATE ": {}\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which commit introduced this bug? This should be mentioned in the commit message so we know whether a backport is necessary.
Your commit message doesn't contain an explanation for why you believe this is necessary. |
7f3efb6
to
00fbaa5
Compare
Thanks for the review. I've added more explanations in the commit messages as well as the commit number. The logging timestamp format can be made optional by configuration if you prefer. |
I think forcing time stamps on stdout is a bad thing because then you have two time stamps on each line when logging to syslog/journald. I hate when programs do that. It's okay to have the feature, but it should be opt-in. I don't see why the TLS patch is necessary. I try to avoid TLS whenever possible. But let's talk about when this really helps: when two threads want to format a time stamp at exactly the same time. What's the worst that will happen? Both printing the exact time stamp to the buffer, and then both have the same string instead of .... having the same string? Is this worth the trouble? If it's worth it, then it should be a caller-provided buffer, not a TLS buffer. |
00fbaa5
to
0bf469d
Compare
As far as I can tell, enabling the timestamp in
Yes, the chance of something bad happening is negligible. But to me it still feels wrong leaving it like than. BTW, why "try to avoid TLS whenever possible"? (PS. still trying to fix the mingw test build failure (it succeeds locally with the same mingw version). |
You're right, I have merged this commit.
But what is "something bad"? Is your bad (subjective) feeling the worst that can happen, or do you have something else in mind? Is there a concrete bad consequence for this piece of not-100%-correct code? I don't think millisecond resolution is necessary or even useful (and it costs screen space), and your code to calculate the milliseconds is rather clumsy; it first converts to |
…ic buffer for thread safety.
Having milliseconds resolution in the log gives more information than just seconds when debugging or analyzing response time issues or effects of changes in server or client code.
Log messages are prefixed with a timestamp when written to a log file or to stdout (but not when written to syslog or to systemd log). The default timestamp is in seconds. It can be configured by setting log_timestamp to one of: none, minutes, seconds, or milliseconds. Example: none: "message" (without timestamp) minutes: "Jan 30 17:11 : message" seconds: "Jan 30 17:11:32 : message" milliseconds: "Jan 30 17:11:32.271 : message" Having milliseconds resolution in the log gives more information than just seconds when debugging or analyzing response time issues or effects of changes in server or client code.
4f71ec7
to
852b7b9
Compare
Nothing concrete just subjective. Except maybe more CPU cache efficient? But again probably negligible.
I've added a configurable timestamp that can be set to none, minutes, seconds, or milliseconds. |
No description provided.