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

Event.ctx to support OpenTelemetry #501

Closed
wcarmon opened this issue Oct 28, 2022 · 1 comment
Closed

Event.ctx to support OpenTelemetry #501

wcarmon opened this issue Oct 28, 2022 · 1 comment

Comments

@wcarmon
Copy link

wcarmon commented Oct 28, 2022

Is there an idiomatic way to access context.Context from an Event?

My goal is to support OpenTelemetry's span.AddEvent(...) seamlessly

(eg. if a span is in ctx, log.Info().Msg("foo") should invoke span.AddEvent(...))

@danielbprice
Copy link
Contributor

Hi @wcarmon, I worked on adding support for getting the context into the Event. I believe that #559 has resolved this. The caveat is that you will have to pass the ctx in: log.Info().Ctx(ctx).Msg("foo"), and you will need to write a Hook which does this and add it to your logger.

@rs rs closed this as completed Jul 25, 2023
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

No branches or pull requests

3 participants