IMessageBuilder

interface IMessageBuilder

An interface for building messages using a simple DSL.

Alongside build and the string invocation operator, this interface exposes shorthand properties for commonly used log levels. These are intended to be passed into String.invoke inside the builder block:

logI {
"Header"()
"Something failed"(E)
"Extra details"(D)
}

Properties

Link copied to clipboard
open val D: Level

Shorthand for Level.Debug when tagging a DSL line with the debug level.

Link copied to clipboard
open val E: Level

Shorthand for Level.Error when tagging a DSL line with the error level.

Link copied to clipboard
open val I: Level

Shorthand for Level.Info when tagging a DSL line with the info level.

Link copied to clipboard
open val V: Level

Shorthand for Level.Verbose when tagging a DSL line with the verbose level.

Link copied to clipboard
open val W: Level

Shorthand for Level.Warn when tagging a DSL line with the warning level.

Functions

Link copied to clipboard
abstract fun build(): String

Builds and returns the final message as a string.

Link copied to clipboard
abstract operator fun String.invoke(level: Level? = null)

Adds a new message line to this builder via a DSL-style string invocation.