diff --git a/src/main/kotlin/gg/scala/flavor/Flavor.kt b/src/main/kotlin/gg/scala/flavor/Flavor.kt index 5706b26..e38a109 100644 --- a/src/main/kotlin/gg/scala/flavor/Flavor.kt +++ b/src/main/kotlin/gg/scala/flavor/Flavor.kt @@ -14,15 +14,18 @@ import kotlin.reflect.KClass * @since 1/2/2022 */ class Flavor( - private val initializer: KClass<*> + private val initializer: KClass<*>, + private val options: FlavorOptions ) { companion object { @JvmStatic - inline fun create(): Flavor + inline fun create( + options: FlavorOptions = FlavorOptions() + ): Flavor { - return Flavor(T::class) + return Flavor(T::class, options) } } @@ -84,8 +87,8 @@ class Flavor( close?.invoke(entry.value) } - Logger.getAnonymousLogger().info { - "[Flavor] Shutdown [${ + options.logger.info { + "[Services] Shutdown [${ service?.name ?: entry.key .java.simpleName }] in ${milli}ms." @@ -160,8 +163,8 @@ class Flavor( configure?.invoke(singleton) } - Logger.getAnonymousLogger().info { - "[Flavor] Loaded [${ + options.logger.info { + "[Services] Loaded [${ service.name.ifEmpty { clazz.java.simpleName } diff --git a/src/main/kotlin/gg/scala/flavor/FlavorOptions.kt b/src/main/kotlin/gg/scala/flavor/FlavorOptions.kt new file mode 100644 index 0000000..b1fe978 --- /dev/null +++ b/src/main/kotlin/gg/scala/flavor/FlavorOptions.kt @@ -0,0 +1,13 @@ +package gg.scala.flavor + +import java.util.logging.Logger + +/** + * @author GrowlyX + * @since 1/2/2022 + */ +data class FlavorOptions +@JvmOverloads +constructor( + val logger: Logger = Logger.getAnonymousLogger() +)