-
Notifications
You must be signed in to change notification settings - Fork 572
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
Allow user to configure timezone #77
Comments
+1. Exactly same issue I have
…On Mon, 11 Jun 2018, 12:45 Ryan Ju, ***@***.***> wrote:
At the moment, the only way to control time format is the
zerolog.TimeFieldFormat.
There should be a way to allow the user to change the timezone of the
timestamp.
Example: a user wants to always log in Zulu timezone (Z without
timezone), no matter where the server is running. If she sets
TimeFieldFormat to 2006-01-02T15:04:05Z, then the timestamp will be wrong
if the server is running anywhere other than UTC.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#77>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATuCwrNvMkXIv_7LY2cf3zBGKIxuS6TRks5t7kozgaJpZM4Uid4k>
.
|
:) Ah of course you can "overload" it with a func..
thanks "
…On Mon, 11 Jun 2018 at 15:44 Ryan Ju ***@***.***> wrote:
@gedw99 <https://github.com/gedw99> I just found a workaround:
https://github.com/rs/zerolog/blob/a025d45231e5359143134c3c73d0b0f3975ed705/globals.go#L31
zerolog. TimestampFunc = func() time.Time {
return time.Now().UTC()
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#77 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ATuCwtnretcjBpRmk5BfSpVAuikVdGP-ks5t7nQigaJpZM4Uid4k>
.
|
Sorry to necro, just posting this for future people (or me when I forget). To get the local time zone:
|
time.Now() by default returning local time |
Is there a way to define the time field format without using a global variable ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At the moment, the only way to control time format is the
zerolog.TimeFieldFormat
.There should be a way to allow the user to change the timezone of the timestamp.
Example: a user wants to always log in Zulu timezone (
Z
without timezone), no matter where the server is running. If she setsTimeFieldFormat
to2006-01-02T15:04:05Z
, then the timestamp will be wrong if the server is running anywhere other than UTC.The text was updated successfully, but these errors were encountered: