io.sentry.event.EventBuilder Java Examples
The following examples show how to use
io.sentry.event.EventBuilder.
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 |
private static void logToSentry(Level level, String tag, String message, Exception ex){ if (!isSentryInitialized) return; Long previousTime = lastSentryExecution; long currentTimestamp = System.currentTimeMillis(); lastSentryExecution = currentTimestamp; if (previousTime == null || (currentTimestamp - previousTime > MINIMUM_INTERVAL)){ EventBuilder eventBuilder = new EventBuilder(); if (level != null){ eventBuilder.withLevel(level.sentryLevel()); } if (!StringUtils.isEmpty(tag)){ eventBuilder.withLogger(tag); } if (!StringUtils.isEmpty(message)){ eventBuilder.withMessage(message); } if (ex != null) { eventBuilder.withSentryInterface(new ExceptionInterface(ex)); } Sentry.capture(eventBuilder); } }
Example #2
Source File: SentryEventHelper.java From weMessage with GNU Affero General Public License v3.0 | 5 votes |
@Override public void helpBuildingEvent(EventBuilder eventBuilder) { String[] proGuardsUuids = getProGuardUuids(); if (proGuardsUuids != null && proGuardsUuids.length > 0) { DebugMetaInterface debugMetaInterface = new DebugMetaInterface(); for (String proGuardsUuid : proGuardsUuids) { debugMetaInterface.addDebugImage(new DebugMetaInterface.DebugImage(proGuardsUuid)); } eventBuilder.withSentryInterface(debugMetaInterface); } }
Example #3
Source File: SentryBugReporter.java From protobuf-jetbrains-plugin with Apache License 2.0 | 5 votes |
@Override public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo, @NotNull Component parentComponent, @NotNull Consumer<SubmittedReportInfo> consumer) { EventBuilder eventBuilder = createEvent(events, additionalInfo); sentry.sendEvent(eventBuilder); consumer.consume(new SubmittedReportInfo(null, null, NEW_ISSUE)); Messages.showInfoMessage(parentComponent, DEFAULT_RESPONSE, DEFAULT_RESPONSE_TITLE); return true; }
Example #4
Source File: SentryBugReporter.java From protobuf-jetbrains-plugin with Apache License 2.0 | 5 votes |
@NotNull private EventBuilder createEvent(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo) { IdeaLoggingEvent ideaEvent = events[0]; EventBuilder eventBuilder = new EventBuilder(); eventBuilder.withMessage(ideaEvent.getMessage()); eventBuilder.withRelease(getPluginVersion()); eventBuilder.withTag(TAG_PLATFORM_VERSION, getPlatformVersion()); eventBuilder.withTag(TAG_OS, SystemInfo.OS_NAME); eventBuilder.withTag(TAG_OS_VERSION, SystemInfo.OS_VERSION); eventBuilder.withTag(TAG_OS_ARCH, SystemInfo.OS_ARCH); eventBuilder.withTag(TAG_JAVA_VERSION, SystemInfo.JAVA_VERSION); eventBuilder.withTag(TAG_JAVA_RUNTIME_VERSION, SystemInfo.JAVA_RUNTIME_VERSION); Object data = ideaEvent.getData(); if (data instanceof LogMessage) { LogMessage logMessage = (LogMessage) data; Throwable throwable = logMessage.getThrowable(); eventBuilder.withSentryInterface(new ExceptionInterface(throwable)); } else if (ideaEvent.getThrowable() != null) { eventBuilder.withSentryInterface(new ExceptionInterface(ideaEvent.getThrowable())); } if (additionalInfo != null) { eventBuilder.withExtra(EXTRA_ADDITIONAL_INFO, additionalInfo); } if (events.length > 1) { eventBuilder.withExtra(EXTRA_MORE_EVENTS, getMoreEvents(events)); } eventBuilder.withExtra(EXTRA_OTHER_PLUGINS, getOtherPluginsInfo()); return eventBuilder; }
Example #5
Source File: SentryHelper.java From MantaroBot with GNU General Public License v3.0 | 5 votes |
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 #6
Source File: SentryHelper.java From MantaroBot with GNU General Public License v3.0 | 5 votes |
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 #7
Source File: SentryHelper.java From MantaroBot with GNU General Public License v3.0 | 5 votes |
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 #8
Source File: SentryHelper.java From MantaroBot with GNU General Public License v3.0 | 5 votes |
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 #9
Source File: SentryHelper.java From MantaroBot with GNU General Public License v3.0 | 5 votes |
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(); }