/** * Send an Event using the statically stored Raven instance. * * @param event Event to send to the Sentry server */ public static void capture(Event event) { verifyStoredInstance(); getStoredInstance().sendEvent(event); }
/** * Creates an instance of Raven using the provided DSN. * * @param dsn Data Source Name of the Sentry server. * @return an instance of Raven. */ public static Raven ravenInstance(Dsn dsn) { return ravenInstance(dsn, null); }
/** * Sends an exception (or throwable) to the Sentry server using the statically stored Raven instance. * <p> * The exception will be logged at the {@link Event.Level#ERROR} level. * * @param throwable exception to send to Sentry. */ public static void capture(Throwable throwable) { verifyStoredInstance(); getStoredInstance().sendException(throwable); }
/** * Sends a message to the Sentry server. * <p> * The message will be logged at the {@link Event.Level#INFO} level. * * @param message message to send to Sentry. */ public void sendMessage(String message) { EventBuilder eventBuilder = new EventBuilder().withMessage(message) .withLevel(Event.Level.INFO); runBuilderHelpers(eventBuilder); Event event = eventBuilder.build(); sendEvent(event); }
/** * Builds and sends an {@link Event} to the Sentry server. * * @param eventBuilder {@link EventBuilder} to send to Sentry. */ public void sendEvent(EventBuilder eventBuilder) { runBuilderHelpers(eventBuilder); Event event = eventBuilder.build(); sendEvent(event); }
/** * Initialises the Raven instance. */ protected synchronized void initRaven() { try { if (dsn == null) { dsn = Dsn.dsnLookup(); } raven = RavenFactory.ravenInstance(new Dsn(dsn), ravenFactory); } catch (InvalidDsnException e) { addError("An exception occurred during the retrieval of the DSN for Raven", e); } catch (Exception e) { addError("An exception occurred during the creation of a Raven instance", e); } }
/** * Initialises the Raven instance. */ protected synchronized void initRaven() { try { if (dsn == null) { dsn = Dsn.dsnLookup(); } raven = RavenFactory.ravenInstance(new Dsn(dsn), ravenFactory); } catch (InvalidDsnException e) { error("An exception occurred during the retrieval of the DSN for Raven", e); } catch (Exception e) { error("An exception occurred during the creation of a Raven instance", e); } }
/** * Initialises the Raven instance. */ protected synchronized void initRaven() { try { if (dsn == null) { dsn = Dsn.dsnLookup(); } raven = RavenFactory.ravenInstance(new Dsn(dsn), ravenFactory); } catch (InvalidDsnException e) { reportError("An exception occurred during the retrieval of the DSN for Raven", e, ErrorManager.OPEN_FAILURE); } catch (Exception e) { reportError("An exception occurred during the creation of a Raven instance", e, ErrorManager.OPEN_FAILURE); } }
@Override public void close() throws SecurityException { RavenEnvironment.startManagingThread(); try { if (raven != null) { raven.closeConnection(); } } catch (Exception e) { reportError("An exception occurred while closing the Raven connection", e, ErrorManager.CLOSE_FAILURE); } finally { RavenEnvironment.stopManagingThread(); } }
/** * Creates an instance of Raven using the DSN obtain through {@link com.getsentry.raven.dsn.Dsn#dsnLookup()}. * * @return an instance of Raven. */ public static Raven ravenInstance() { return ravenInstance(Dsn.dsnLookup()); }
/** * Creates an instance of Raven using the provided DSN. * * @param dsn Data Source Name of the Sentry server. * @return an instance of Raven. */ public static Raven ravenInstance(String dsn) { return ravenInstance(new Dsn(dsn)); }
@Override public void onContextDestroyed() { if (raven != null) { getRaven().closeConnection(); } } }
/** * Sends a message to the Sentry server using the statically stored Raven instance. * <p> * The message will be logged at the {@link Event.Level#INFO} level. * * @param message message to send to Sentry. */ public static void capture(String message) { verifyStoredInstance(); getStoredInstance().sendMessage(message); }
/** * Uses stdout to send the logs. * * @param dsn Data Source Name of the Sentry server. * @return an {@link OutputStreamConnection} using {@code System.out}. */ protected Connection createStdOutConnection(Dsn dsn) { //CHECKSTYLE.OFF: RegexpSinglelineJava OutputStreamConnection stdOutConnection = new OutputStreamConnection(System.out); //CHECKSTYLE.ON: RegexpSinglelineJava stdOutConnection.setMarshaller(createMarshaller(dsn)); return stdOutConnection; }
/** * Record a {@link Breadcrumb} into all of this thread's active contexts. * * @param breadcrumb Breadcrumb to record */ public static void record(Breadcrumb breadcrumb) { Raven.getStoredInstance().getContext().recordBreadcrumb(breadcrumb); }
@Override public void requestDestroyed(ServletRequestEvent servletRequestEvent) { THREAD_REQUEST.remove(); try { Raven raven = Raven.getStoredInstance(); if (raven != null) { raven.getContext().clear(); } } catch (Exception e) { logger.error("Error clearing Context state.", e); } }
Raven blabla = new Raven("Ziosh"); Animal a = blabla;
/** * Builds and sends an {@link Event} to the Sentry server using the statically stored Raven instance. * * @param eventBuilder {@link EventBuilder} to send to Sentry. */ public static void capture(EventBuilder eventBuilder) { verifyStoredInstance(); getStoredInstance().sendEvent(eventBuilder); }
public ReportController() { raven = RavenFactory.ravenInstance(POST_URL); }
public Raven getRaven() { if (raven == null) { raven = RavenFactory.ravenInstance(Application.get().getRemoteConfigLoader().getString(CoreConfigParameter.SENTRY_DSN)); } return raven; }