toDebugString

fun <T : Any> toDebugString(instance: T): String

Produces a YAML-formatted debug string of the configuration instance with secret values masked.

Properties annotated with @Secret are masked according to their configured MaskStrategy (e.g., "s]3cr3t" becomes "s***" with PARTIAL strategy). All other values are rendered normally with comments.

This is safe to use in logging and diagnostic output without risking secret leakage.

Example:

data class DbConfig(
val host: String = "localhost",
@Secret val password: SecretString = SecretString("s3cr3t")
)

val debug = YamlConfigManager.toDebugString(DbConfig())
// Output:
// host: localhost
// password: "********"

Return

A YAML-formatted string with secrets masked.

Since

1.0

Parameters

T

The configuration type.

instance

The configuration instance to render.

See also