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

Override the timestamp key used in zerolog #47

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

josephschorr
Copy link

This prevents it from replacing time keys on logs, particularly for pgx

First part of a fix for authzed/spicedb#58

This prevents it from replacing `time` keys on logs, particularly for pgx

First part of a fix for authzed/spicedb#58
@josephschorr
Copy link
Author

@jzelinskie Let me know if you prefer this to be a function that importers call instead

// override the `time` field name to not conflict with other existing `time` fields
// in logs.
// See: https://github.com/rs/zerolog/blob/1f50797d7d24e4cf3a6407203bd694f3d35de724/event.go#L643
zerolog.TimestampFieldName = "log-timestamp"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in init or New? I could see someone importing this library in the future while not desiring this side affect.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my question: or should it be a function we export from here that the importer calls?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants