feature #10: log Query
This commit is contained in:
8
src/main/kotlin/fr/postgresjson/stopwatch/Stopwatch.kt
Normal file
8
src/main/kotlin/fr/postgresjson/stopwatch/Stopwatch.kt
Normal file
@@ -0,0 +1,8 @@
|
||||
package fr.postgresjson.stopwatch
|
||||
|
||||
fun <T> elapse(callback: (start: Long) -> T, after: (elapse: Long) -> Unit): T {
|
||||
val start = System.currentTimeMillis()
|
||||
val result = callback(start)
|
||||
after(System.currentTimeMillis() - start)
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user