SentryContext

Context object for keeping track of Sentry breadcrumbs and providing convenient APIs for submitting them, along with transaction functions.

Generally speaking, you'll probably want to use this instead of touching Sentry (or the adapter) directly.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Quick access to the Sentry adapter, if required.

Link copied to clipboard

Extra context to be submitted to Sentry along with any captures.

Functions

Link copied to clipboard
suspend fun breadcrumb(type: BreadcrumbType = BreadcrumbType.Default, body: suspend SentryBreadcrumbCapture.() -> Unit)

Register a breadcrumb of the given type, using the body to modify it and add context.

Link copied to clipboard
suspend fun captureEvent(event: SentryEvent, body: suspend SentryScopeCapture.() -> Unit = {}): SentryId?

Capture a SentryEvent, submitting it to Sentry with the breadcrumbs in this context.

Link copied to clipboard
suspend fun captureFeedback(feedback: UserFeedback, body: suspend SentryScopeCapture.() -> Unit = {})

Capture a UserFeedback object, submitting it to Sentry with the breadcrumbs in this context.

Link copied to clipboard
suspend fun captureMessage(message: String, body: suspend SentryScopeCapture.() -> Unit = {}): SentryId?

Capture a message String, submitting it to Sentry with the breadcrumbs in this context.

Link copied to clipboard
suspend fun captureThrowable(t: Throwable, body: suspend SentryExceptionCapture.() -> Unit = {}): SentryId?

Capture a Throwable exception, submitting it to Sentry with the breadcrumbs in this context.

Link copied to clipboard
fun context(key: String, value: Any)

Add an extra context value, to be submitted to Sentry along with any capture.

Link copied to clipboard

Make a copy of this Sentry context, bringing the breadcrumbs over into a new list.

Link copied to clipboard
open override fun getKoin(): Koin

Get the associated Koin instance.

Link copied to clipboard
inline fun transaction(transaction: ITransaction, body: ITransaction.() -> Unit)

Use the given transaction to measure the given callable.

inline fun transaction(name: String, operation: String, body: ITransaction.() -> Unit)

Create a transaction with the given name and operation, and use it to measure the given callable.