public final class Sentry extends Object
SentryClient
instance.Modifier and Type | Method and Description |
---|---|
static void |
capture(Event event)
Send an Event using the statically stored
SentryClient instance. |
static void |
capture(EventBuilder eventBuilder)
Builds and sends an
Event to the Sentry server using the statically stored
SentryClient instance. |
static void |
capture(String message)
Sends a message to the Sentry server using the statically stored
SentryClient instance. |
static void |
capture(Throwable throwable)
Sends an exception (or throwable) to the Sentry server using the statically stored
SentryClient instance. |
static void |
clearContext()
Clears the current context.
|
static void |
close()
Close the stored
SentryClient 's connections and remove it from static storage. |
static SentryClient |
getStoredClient()
Returns the last statically stored
SentryClient instance. |
static SentryClient |
init()
Initialize and statically store a
SentryClient by looking up
a Dsn and automatically choosing a SentryClientFactory . |
static SentryClient |
init(SentryClientFactory sentryClientFactory)
Initialize and statically store a
SentryClient by looking up
a Dsn and using the provided SentryClientFactory . |
static SentryClient |
init(String dsn)
Initialize and statically store a
SentryClient by using the provided
Dsn and automatically choosing a SentryClientFactory . |
static SentryClient |
init(String dsn,
SentryClientFactory sentryClientFactory)
|
static void |
record(Breadcrumb breadcrumb)
Record a
Breadcrumb . |
static void |
setStoredClient(SentryClient client)
Set the statically stored
SentryClient instance. |
static void |
setUser(User user)
Set the
User in the current context. |
public static SentryClient init()
SentryClient
by looking up
a Dsn
and automatically choosing a SentryClientFactory
.public static SentryClient init(SentryClientFactory sentryClientFactory)
SentryClient
by looking up
a Dsn
and using the provided SentryClientFactory
.sentryClientFactory
- SentryClientFactory to use.public static SentryClient init(String dsn)
SentryClient
by using the provided
Dsn
and automatically choosing a SentryClientFactory
.dsn
- Data Source Name of the Sentry server.public static SentryClient init(String dsn, SentryClientFactory sentryClientFactory)
SentryClient
by using the provided
Dsn
and SentryClientFactory
.
Note that the Dsn or SentryClientFactory may be null, at which a best effort attempt is made to look up or choose the best value(s).
dsn
- Data Source Name of the Sentry server.sentryClientFactory
- SentryClientFactory to use.public static SentryClient getStoredClient()
SentryClient
instance. If no instance
is already stored, the init()
method will be called one time in an attempt to
create a SentryClient
.SentryClient
instance, or null.public static void setStoredClient(SentryClient client)
SentryClient
instance.client
- SentryClient
instance to store.public static void capture(Event event)
SentryClient
instance.event
- Event to send to the Sentry server.public static void capture(Throwable throwable)
SentryClient
instance.
The exception will be logged at the Event.Level#ERROR
level.
throwable
- exception to send to Sentry.public static void capture(String message)
SentryClient
instance.
The message will be logged at the Event.Level#INFO
level.
message
- message to send to Sentry.public static void capture(EventBuilder eventBuilder)
Event
to the Sentry server using the statically stored
SentryClient
instance.eventBuilder
- EventBuilder
to send to Sentry.public static void record(Breadcrumb breadcrumb)
Breadcrumb
.breadcrumb
- Breadcrumb to record.public static void setUser(User user)
User
in the current context.user
- User to store.public static void clearContext()
public static void close()
SentryClient
's connections and remove it from static storage.Copyright © 2012–2017. All rights reserved.