SentryLogBuilder

DSL builder for structured log messages with attributes.

Use this builder inside logger.<level> { } blocks to set the message and optional attributes.

Message

  • message with a single string sets a plain message body

  • message with template and args enables structured logging (template is captured separately)

  • If called multiple times, the last call wins

Attributes

  • attributes with a block allows inline attribute definition using this[key] = value

  • attributes with a prebuilt SentryAttributes merges those attributes

  • Multiple calls merge into the same set; duplicate keys use the last value

Functions

Link copied to clipboard
abstract fun attributes(prebuilt: SentryAttributes)

Merges prebuilt attributes into this log entry.

abstract fun attributes(block: SentryAttributes.() -> Unit)

Defines attributes inline using a DSL block.

Link copied to clipboard
abstract fun buildFormatted(): FormattedLog?

Builds a formatted log entry with message substitution done.

Link copied to clipboard
abstract fun message(body: String)

Sets a plain message body without template parameters.

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

Sets a structured message with template and parameters.

Properties

Link copied to clipboard
abstract val args: Array<out Any?>

The message arguments for substitution.

Link copied to clipboard

The custom attributes set by the user.

Link copied to clipboard
abstract val template: String?

The message template, or null if not set.