io.sentry.event.Event Java Examples

The following examples show how to use io.sentry.event.Event. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServerLogger.java    From weMessage with GNU Affero General Public License v3.0 5 votes vote down vote up
public Event.Level sentryLevel(){
    switch (value){
        case 0:
            return Event.Level.INFO;
        case 1:
            return Event.Level.WARNING;
        case 2:
            return Event.Level.ERROR;
        case 3:
            return Event.Level.ERROR;
        default:
            return Event.Level.DEBUG;
    }
}
 
Example #2
Source File: SentryHelper.java    From MantaroBot with GNU General Public License v3.0 5 votes vote down vote up
public static void captureException(String message, Throwable t, Class<?> clazz) {
    EventBuilder eventBuilder = new EventBuilder()
            .withMessage(message)
            .withLevel(Event.Level.ERROR)
            .withLogger(clazz.getName())
            .withSentryInterface(new ExceptionInterface(t));
    Sentry.capture(eventBuilder);
}
 
Example #3
Source File: SentryHelper.java    From MantaroBot with GNU General Public License v3.0 5 votes vote down vote up
public static void captureMessage(String message, Class<?> clazz) {
    EventBuilder eventBuilder = new EventBuilder()
            .withMessage(message)
            .withLevel(Event.Level.INFO)
            .withLogger(clazz.getName());

    Sentry.capture(eventBuilder);
}
 
Example #4
Source File: SentryHelper.java    From MantaroBot with GNU General Public License v3.0 5 votes vote down vote up
public static void captureExceptionContext(String message, Throwable t, Class<?> clazz, String user) {
    final Context context = Sentry.getContext();
    context.setUser(new UserBuilder().setUsername(user).build());
    EventBuilder eventBuilder = new EventBuilder()
            .withMessage(message)
            .withLevel(Event.Level.ERROR)
            .withLogger(clazz.getName())
            .withSentryInterface(new ExceptionInterface(t));
    Sentry.capture(eventBuilder);
    Sentry.clearContext();
}
 
Example #5
Source File: SentryHelper.java    From MantaroBot with GNU General Public License v3.0 5 votes vote down vote up
public static void captureMessageContext(String message, Class<?> clazz, String user) {
    final Context context = Sentry.getContext();
    context.setUser(new UserBuilder().setUsername(user).build());
    EventBuilder eventBuilder = new EventBuilder()
            .withMessage(message)
            .withLevel(Event.Level.INFO)
            .withLogger(clazz.getName());

    Sentry.capture(eventBuilder);
    Sentry.clearContext();
}
 
Example #6
Source File: SentryHelper.java    From MantaroBot with GNU General Public License v3.0 5 votes vote down vote up
public static void captureMessageErrorContext(String message, Class<?> clazz, String user) {
    final Context context = Sentry.getContext();
    context.setUser(new UserBuilder().setUsername(user).build());
    EventBuilder eventBuilder = new EventBuilder()
            .withMessage(message)
            .withLevel(Event.Level.ERROR)
            .withLogger(clazz.getName());

    Sentry.capture(eventBuilder);
    Sentry.clearContext();
}