Skip to content

Instantly share code, notes, and snippets.

@oshai
Created December 5, 2017 20:50
Show Gist options
  • Save oshai/d5ebd1f38de8198c6f11c3a232be2782 to your computer and use it in GitHub Desktop.
Save oshai/d5ebd1f38de8198c6f11c3a232be2782 to your computer and use it in GitHub Desktop.
exposed logging
// Usage
transaction {
logger.addLogger(KotlinLoggingSqlLogger)
...
}
// Declaration
object KotlinLoggingSqlLogger : SqlLogger {
private val logger = KotlinLogging.logger { }
override
fun log(context: StatementContext, transaction: Transaction) {
logger.info { "SQL: ${context.expandArgs(transaction)}" }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment