All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.lexi.ConsoleConfigurationUtils.kt Maven / Gradle / Ivy

The newest version!
package lexi

fun Map.toConsoleAppenderOptions(): ConsoleAppenderOptions = ConsoleAppenderOptions(
    level = LogLevel.parse(getOrElse("level") { "DEBUG" }) ?: LogLevel.DEBUG,
    verbose = getOrElse("verbose") { "true" }.toBoolean(),
    formatter = when (val formatter = getOrElse("formatter") { "simple" }) {
        "simple" -> SimpleLogFormatter(toSimpleFormatterOptions())
        "json" -> JsonLogFormatter(toJsonFormatterOptions())
        else -> throw IllegalArgumentException("Unknown formatter type: $formatter")
    }
)

fun Map.toConsoleAppender() = ConsoleAppender(toConsoleAppenderOptions())




© 2015 - 2024 Weber Informatics LLC | Privacy Policy