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

log.FromContext doesn't add provided tags and doesn't handle empty contexts #1140

Closed
charithe opened this issue Aug 26, 2020 · 0 comments · Fixed by #1141
Closed

log.FromContext doesn't add provided tags and doesn't handle empty contexts #1140

charithe opened this issue Aug 26, 2020 · 0 comments · Fixed by #1141

Comments

@charithe
Copy link
Contributor

charithe commented Aug 26, 2020

I came across a couple of bugs in the log.FromContext function:

  • If the passed in context doesn't contain a logger, it attempts to cast a nil value as logr.Logger -- which causes a panic.
  • The keysAndValues argument has no effect because the logger returned from the WithValues method is ignored in the return value.

I have a patch that should address these here: master...charithe:fix/logging-ctx

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 a pull request may close this issue.

1 participant