Skip to content

Commit 6a7d280

Browse files
committed
Some kotlin utilities
1 parent d1ebe9e commit 6a7d280

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.github.fernthedev.fernapi.universal
2+
3+
import java.util.*
4+
5+
/**
6+
* Lazy debug logger to improve performance
7+
*/
8+
fun debugLog(supplier: () -> String) {
9+
if (Universal.isDebug()) {
10+
Universal.debug(supplier())
11+
}
12+
}
13+
14+
/**
15+
* Lazy debug logger to improve performance
16+
*/
17+
@JvmName("debugLog1")
18+
fun debugLog(supplier: () -> Pair<String, Array<Any>>) {
19+
if (Universal.isDebug()) {
20+
val (str, obj) = supplier()
21+
Universal.debug(str, obj)
22+
}
23+
}

0 commit comments

Comments
 (0)