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

Add support for TimeEncoding for Zap logger #10205

Closed

Conversation

jeff303
Copy link

@jeff303 jeff303 commented May 22, 2024

Description

  • Add TimeEncoding field under LogsConfig to control Zap logger time encoding explicitly
  • Update newLogger to read and interpret the selected option

Link to tracking issue

Fixes #10204

Testing

None yet (wasn't able to find existing tests for newLogger)

Documentation

None yet (unsure where the docs for this live)

encoding explicitly

Update newLogger to read and interpret the selected option
@jeff303 jeff303 requested review from a team and atoulme May 22, 2024 02:59
Copy link

CLA Not Signed

Comment on lines +96 to +107
// TimeEncoding controls the zap logger's time encoding
// Permitted values are:
// - "Epoch"
// - "EpochMillis"
// - "EpochNanos"
// - "ISO8601"
// - "RFC3339"
// - "RFC3339Nano"
// Leaving the value blank results in the default time encoding, which
// depends on the message encoding (for JSON, it will be EpochNanos,
// and for console, it will be ISO8601
TimeEncoding string `mapstructure:"time_encoding"`
Copy link
Member

Choose a reason for hiding this comment

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

We would prefer not to derive from the zap.Config. Is this there already? if yes, can you add a link to confirm the name?

Copy link
Author

Choose a reason for hiding this comment

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

Apologies, but I'm not following this. I wasn't able to find any mechanism by which I can set the Zap logger's time encoding through the existing telemetry config, hence the new field. One can only indirectly influence it (ex, by choosing console as the format), but there is no way to use, say, RFC3339 time encoding along with JSON formatted messages.

Copy link
Contributor

github-actions bot commented Jun 7, 2024

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jun 7, 2024
Copy link
Contributor

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow configuration of the service Zap logger Encodetime
2 participants