Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support named parameters for event messages #750

Closed
mfb opened this issue Jan 27, 2019 · 2 comments · Fixed by #752
Closed

Support named parameters for event messages #750

mfb opened this issue Jan 27, 2019 · 2 comments · Fixed by #752
Milestone

Comments

@mfb
Copy link
Contributor

mfb commented Jan 27, 2019

In version 1.x, we can send messages with named parameters to Sentry server, e.g.

$message = 'Hello %planet.';
$params = ['%planet' => 'world'];
$data['sentry.interfaces.Message'] = [
  'message' => $message,
  'params' => $params,
  'formatted' => strtr($message, $params),
];

I'm not sure how to do this for events in 2.x - it looks like it forcibly sets formatted to vsprintf($this->message, $this->messageParams).

@ste93cry
Copy link
Collaborator

I don't see any reference in the docs for named parameters and looking at version 1.x vsprintf was used too, the only way to do what you described was to manually edit the payload of the event so I think we should not support this use case if it's not an official feature

@mfb
Copy link
Contributor Author

mfb commented Jan 27, 2019

Yes we are using sentry.interfaces.Message, which does support params being a dictionary, and they are rendered nicely in the Sentry UI. All we need is a way to pass in the formatted message, rather than always forcibly generating it.

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

Successfully merging a pull request may close this issue.

3 participants