MessageDSL

class MessageDSL(strategy: LoggingStrategy, logToConsole: Boolean = true)(source)

DSL for constructing structured Message instances.

Provides a builder-like syntax to compose multi-line logs, key-value pairs, and toggle console output.

Example:

lumina.info {
+"Starting application" // is a new line
+"Version: 1.0.0"
+("Hello, " + "World!") // also a new line, but output is "Hello, World!"
logToConsole = false // disable console output
emptyLine() // insert a blank line
line("Config:") // also a new line
keyValue {
define("Config", "dbUrl", "jdbc://localhost:5432")
}
}

Supports both free-form text and structured key-value fields.

  • Use line or the unary plus operator (+) to add a plain line.

  • Use keyValue to add structured data (Object(key=value)).

  • Use emptyLine to insert a blank line.

  • Use logToConsole to enable/disable console output for this message.

Finally, call build (done automatically by Lumina.log) to produce a Message.

Constructors

Link copied to clipboard
constructor(strategy: LoggingStrategy, logToConsole: Boolean = true)

Types

Link copied to clipboard

Functions

Link copied to clipboard
fun build(): Message
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun line(vararg content: String, delimiter: String = " "): MessageDSL
Link copied to clipboard
fun logToConsole(enabled: Boolean = true): MessageDSL
Link copied to clipboard
operator fun String.unaryPlus(): MessageDSL