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

jvmMain.index_jvm.kt Maven / Gradle / Ivy

There is a newer version: 0.77.0
Show newest version
package de.peekandpoke.ultra.logging

import de.peekandpoke.ultra.kontainer.InjectionContext
import de.peekandpoke.ultra.kontainer.KontainerBuilder
import de.peekandpoke.ultra.kontainer.module

@Suppress("unused")
fun KontainerBuilder.ultraLogging() = module(Ultra_Logging)

/**
 * Ultra Logging kontainer module
 *
 * You can inject context aware instances of [Log] into your kontainer services:
 *
 * 
 *     class MyService(log: Log) { ... }
 * 
 *
 * For a simple [ConsoleAppender] add a:
 *
 * 
 * singleton(ConsoleAppender::class)
 * 
 *
 * For an [Slf4jAppender] add a:
 *
 * 
 * singleton { logger: org.slf4j.Logger -> Slf4jAppender(logger) }
 * 
 */
val Ultra_Logging = module {

    dynamic(UltraLogManager::class)

    // TODO: we need another injection type: dynamicPrototype.
    //       It must upgrade the injecting service to SemiDynamic.
    //       But it must be instantiated like a prototype.
    prototype(Log::class) { manager: UltraLogManager, context: InjectionContext ->
        manager.getLogger(context.requestingClass)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy