error

abstract fun error(message: String, vararg args: Any?)

Logs a message at SentryLogLevel.ERROR level.

Parameters

message

The message template (use %s for substitution, %% for literal %)

args

Arguments to substitute into the message template via toString()


abstract fun error(message: String, vararg args: Any?, attributes: SentryAttributes.() -> Unit)

Logs a message at SentryLogLevel.ERROR level with template parameters and inline attributes.

Example:

Sentry.logger.error("Failed to process order %s: %s", orderId, error) {
this["orderId"] = "order_123"
this["amount"] = 99.99
}

Parameters

message

The message template (use %s for substitution, %% for literal %)

args

Arguments to substitute into the message template via toString()

attributes

A lambda with SentryAttributes receiver to set key-value attributes


abstract fun error(message: String, attributes: SentryAttributes.() -> Unit)

Logs a message at SentryLogLevel.ERROR level with inline attributes.

Example:

Sentry.logger.error("Failed to process payment") {
this["orderId"] = "order_123"
this["amount"] = 99.99
}

Parameters

message

The log message

attributes

A lambda with SentryAttributes receiver to set key-value attributes


abstract fun error(block: SentryLogBuilder.() -> Unit)

Logs a message at SentryLogLevel.ERROR level using a DSL builder.

Example:

Sentry.logger.error {
message("Failed to process payment for order %s: %s", orderId, error.message)
attributes {
this["order.amount"] = amount
this["payment.provider"] = "stripe"
this["error.code"] = error.code
}
}

Parameters

block

A lambda with SentryLogBuilder receiver to configure the log entry