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

otelslog: WithSource #6244

Closed
Jesse0Michael opened this issue Oct 14, 2024 · 2 comments · Fixed by #6253
Closed

otelslog: WithSource #6244

Jesse0Michael opened this issue Oct 14, 2024 · 2 comments · Fixed by #6253
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Jesse0Michael
Copy link
Contributor

Jesse0Michael commented Oct 14, 2024

Problem Statement

I would love to move to an otel logger from slog using the slog bridge, but there is one feature that I would miss.
The HandlerOptions used to configure a slog JSONHandler or TextHandler allow for a bool toggle AddSource which, when set, will include the source file information of where the log occurred in the log attributes.

Proposed Solution

I would like to add a bool source field to the otelslog config that is set in a new WithSource Option that takes a bool as a parameter. When source is set, the otelbridge would mimic the behavior of the slog options and include the source information of the log as attributes when converting the slog record.

@Jesse0Michael Jesse0Michael added the enhancement New feature or request label Oct 14, 2024
@dmathieu
Copy link
Member

This makes sense. Do you want to work on a PR?
Should we also provide ReplaceAttr? (in a different PR)

@Jesse0Michael
Copy link
Contributor Author

Yeah, I can work on a WithSource PR!

ReplaceAttr isn't something that I personally use, so I am less familiar with it... but i imagine someone out there could want it.

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

Successfully merging a pull request may close this issue.

3 participants