public class MessageInterface extends Object implements SentryInterface
Sentry's ability to regroup event with the same messages is based on the content of the message, meaning that an
Event
with the message "User1 failed to provide an email address"
won't be grouped with an Event with the message "User2 failed to provide an email address".
To allow this kind of grouping, sentry supports the message interface which will provide both the pattern of the
message and the parameters. In this example the pattern could be:
{} failed to provide an email address
And the parameters would be User1 in the first Event and User2 in the second Event.
This way, Sentry will be able to put the two events in the same category.
Note: Sentry won't attempt to format the message, this is why the formatted message should be set through
EventBuilder.withMessage(String)
in any case.
Modifier and Type | Field and Description |
---|---|
static String |
MESSAGE_INTERFACE
Name of the message interface in Sentry.
|
Constructor and Description |
---|
MessageInterface(String message)
Creates a non parametrised message.
|
MessageInterface(String message,
List<String> parameters)
Creates a parametrised message for an
Event . |
MessageInterface(String message,
List<String> parameters,
String formatted)
Creates a parametrised message for an
Event . |
MessageInterface(String message,
String... params)
Creates a parametrised message for an
Event . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
String |
getFormatted() |
String |
getInterfaceName()
Gets the unique name of the interface.
|
String |
getMessage() |
List<String> |
getParameters() |
int |
hashCode() |
String |
toString() |
public static final String MESSAGE_INTERFACE
public MessageInterface(String message)
While it's technically possible to create a non parametrised message with MessageInterface
, it's
recommended to use EventBuilder.withMessage(String)
instead.
message
- message to add to the event.public MessageInterface(String message, String... params)
Event
.message
- original message.params
- parameters of the message.public MessageInterface(String message, List<String> parameters)
Event
.message
- original message.parameters
- parameters of the message.public String getInterfaceName()
SentryInterface
getInterfaceName
in interface SentryInterface
public String getMessage()
public String getFormatted()
Copyright © 2012–2020. All rights reserved.