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

proposal: log/slog: default key names as HandlerOptions, but not constants #63665

Closed
KacperPerschke opened this issue Oct 22, 2023 · 3 comments
Closed
Labels
Milestone

Comments

@KacperPerschke
Copy link

The log/slog package has appeared in the standard library for go 1.21. Thank you!

In version 1.21.3 it provides a commonHandler which has hardcoded key names.

For ECS compatibility reasons, could the key names be HandlerOptions settings rather than constants? Please.

In ECS current release (8.10) the names of these fields are:

  1. TimeKey@timestamp
  2. LevelKeylog.level
  3. MessageKeymessage
  4. SourceKey → two fields log.origin.file.name & log.origin.file.line
@gopherbot gopherbot added this to the Proposal milestone Oct 22, 2023
@seankhliao
Copy link
Member

Our supported way of doing this is with ReplaceAttr. See the field docs for details

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Oct 22, 2023
@KacperPerschke
Copy link
Author

Thank you very much!

@KacperPerschke
Copy link
Author

Minimal code based on Sean's tips. As a hint for someone who would come here.

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

No branches or pull requests

3 participants