Scope

interface Scope

The Scope holds useful information that should be sent along with the event. For instance contexts or breadcrumbs are stored on the scope.

Users should not need to implement this interface instead the Scope should be provided by the SDK. Different platforms have specific scope providers that are used internally:

  • For JVM: io.sentry.kotlin.multiplatform.JvmScopeProvider

  • For Cocoa: io.sentry.kotlin.multiplatform.CocoaScopeProvider

Functions

Link copied to clipboard
abstract fun addAttachment(attachment: Attachment)

Adds an attachment to the Scope's list of attachments. The SDK adds the attachment to every event and transaction sent to Sentry.

Link copied to clipboard
abstract fun addBreadcrumb(breadcrumb: Breadcrumb)

Adds a breadcrumb to the breadcrumbs queue

Link copied to clipboard
abstract fun clear()

Resets the Scope to its default state

Link copied to clipboard
abstract fun clearAttachments()

Clear all attachments

Link copied to clipboard
abstract fun clearBreadcrumbs()

Clear all the breadcrumbs

Link copied to clipboard
abstract fun getContexts(): MutableMap<String, Any>

Returns the Scope's contexts

Link copied to clipboard
abstract fun getTags(): MutableMap<String, String>

Returns the scope's tags

Link copied to clipboard
abstract fun removeContext(key: String)

Removes a value from the Scope's contexts

Link copied to clipboard
abstract fun removeExtra(key: String)

Removes an extra from the Scope's extras

Link copied to clipboard
abstract fun removeTag(key: String)

Removes a tag from the Scope's tags

Link copied to clipboard
abstract fun setContext(key: String, value: Any)
abstract fun setContext(key: String, value: Boolean)

Sets the Scope's contexts

abstract fun setContext(key: String, value: Array<*>)
abstract fun setContext(key: String, value: Char)
abstract fun setContext(key: String, value: Number)
abstract fun setContext(key: String, value: String)
abstract fun setContext(key: String, value: Collection<*>)

Sets the Scope's context

Link copied to clipboard
abstract fun setExtra(key: String, value: String)

Sets an extra to the Scope's extra map

Link copied to clipboard
abstract fun setTag(key: String, value: String)

Sets a tag to Scope's tags

Properties

Link copied to clipboard
abstract var level: SentryLevel?

The Scope's level

Link copied to clipboard
abstract var user: User?

The Scope's user