warn

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

Logs a message at SentryLogLevel.WARN level.

Parameters

message

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

args

Arguments to substitute into the message template via toString()


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

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

Example:

Sentry.logger.warn("Rate limit reached for endpoint") {
this["endpoint"] = "/api/results/"
this["isEnterprise"] = false
}

Parameters

message

The log message

attributes

A lambda with SentryAttributes receiver to set key-value attributes


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

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

Example:

Sentry.logger.warn("Rate limit at %s%% for endpoint %s", usage, endpoint) {
this["endpoint"] = "/api/results/"
this["isEnterprise"] = false
}

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 warn(block: SentryLogBuilder.() -> Unit)

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

Example:

Sentry.logger.warn {
message("API rate limit at %s%% for client %s", usagePercent, clientId)
attributes {
this["rate_limit.current"] = currentRequests
this["rate_limit.max"] = maxRequests
this["rate_limit.reset_at"] = resetTimestamp
}
}

Parameters

block

A lambda with SentryLogBuilder receiver to configure the log entry