mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-22 00:27:15 +00:00
improvements in microutils
This commit is contained in:
parent
99c0f06b72
commit
e0bdd5dfdc
@ -5,6 +5,7 @@
|
||||
* `Startup`:
|
||||
* `Launcher`:
|
||||
* Improvements in `StartLauncherPlugin#start` methods
|
||||
* Add opportunity to pass second argument on `JVM` platform as log level
|
||||
* `Repos`:
|
||||
* `Ktor`:
|
||||
* `Client`:
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.micro_utils.startup.launcher
|
||||
|
||||
import dev.inmo.kslog.common.KSLog
|
||||
import dev.inmo.kslog.common.LogLevel
|
||||
import dev.inmo.kslog.common.i
|
||||
import kotlinx.serialization.json.jsonObject
|
||||
import java.io.File
|
||||
@ -23,10 +24,25 @@ import java.io.File
|
||||
* In that case in `build/distributions` folder you will be able to find zip and tar files with all required
|
||||
* tools for application running (via their `bin/app_name` binary). In that case yoy will not need to pass
|
||||
* `--args=...` and launch will look like `./bin/app_name sample.config.json`
|
||||
*
|
||||
* ## Debug mode
|
||||
*
|
||||
* You may pass the second parameter, one of [LogLevel] enum variants to setup [KSLog] minimal logging level. Sample:
|
||||
*
|
||||
* ```bash
|
||||
* ./gradlew run --args="sample.config.json DEBUG" // enable debugging output
|
||||
* ```
|
||||
*
|
||||
* OR
|
||||
* ```bash
|
||||
* ./gradlew run --args="sample.config.json WARNING" // enable logging since WARNING
|
||||
* ```
|
||||
*
|
||||
* **Default level is [LogLevel.INFO]**
|
||||
*/
|
||||
suspend fun main(args: Array<String>) {
|
||||
|
||||
KSLog.default = KSLog("Launcher")
|
||||
KSLog.default = KSLog("Launcher", args.getOrNull(1) ?.let { LogLevel.valueOf(it) } ?: LogLevel.INFO)
|
||||
val (configPath) = args
|
||||
val file = File(configPath)
|
||||
KSLog.i("Start read config from ${file.absolutePath}")
|
||||
|
Loading…
Reference in New Issue
Block a user