log

abstract fun log(level: SentryLogLevel, message: String, vararg args: Any?)

Logs a message at a specific level.

Parameters

level

The log level

message

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

args

Arguments to substitute into the message template via toString()


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

Logs a message at a specific level with inline attributes.

Parameters

level

The log level

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 log(level: SentryLogLevel, block: SentryLogBuilder.() -> Unit)

Logs a message at a specific level using a DSL builder.

Example:

Sentry.logger.log(SentryLogLevel.INFO) {
message("User %s authenticated via %s", userId, method)
attributes {
this["auth.method"] = "oauth2"
this["user.id"] = userId
}
}

Parameters

level

The log level

block

A lambda with SentryLogBuilder receiver to configure the log entry