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

Message interpolation #664

Closed
whatyouhide opened this issue Dec 6, 2023 · 2 comments · Fixed by #670
Closed

Message interpolation #664

whatyouhide opened this issue Dec 6, 2023 · 2 comments · Fixed by #670

Comments

@whatyouhide
Copy link
Collaborator

Messages support interpolation:

{
  "message": {
    "message": "My raw message with interpreted strings like %s",
    "params": ["this"]
  }
}

I assume this is used to easily group messages regardless of the values being interpolated. If so, I think we should support this in the Sentry.capture_message/1 function. A couple of proposed APIs:

# Option #1: with a tuple
Sentry.capture_message({"Interpolated %s", ["message"]}, options)

# Option #2: through options
Sentry.capture_message("Interpolated %s", formatting_parameters: ["message"])
@whatyouhide
Copy link
Collaborator Author

cc @sl0thentr0py

@sl0thentr0py
Copy link
Member

yes indeed, we do this in python in our logging integration but we don't expose the params in capture_message yet, but we should.

I like option 2 a bit more, because it makes the optionality explicit.

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

Successfully merging a pull request may close this issue.

2 participants