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

io.tcds.orm.connection.ConnectionLogger.kt Maven / Gradle / Ivy

package io.tcds.orm.connection

import io.tcds.orm.Param
import org.slf4j.Logger

interface ConnectionLogger {
    companion object {
        fun read(logger: Logger, sql: String, params: List>) {
            logger.info("ORM READ: ${sql.trim()} ${params(params)}")
        }

        fun write(logger: Logger, sql: String, params: List>) {
            logger.info("ORM WRITE: ${sql.trim()} ${params(params)}")
        }

        private fun params(params: List>): String {
            val list = params.mapIndexed { index, it -> "$index: ${it.name} = ${it.plain()}" }

            return "\n\t" + list.joinToString("\n\t")
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy