mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-25 18:01:27 +02:00
new parameter to only log when a given amount of ms have passed.
This commit is contained in:
@@ -152,11 +152,14 @@ fun debugState(context: Context) {
|
||||
|
||||
inline fun <T> logTime(
|
||||
debugMessage: String,
|
||||
minToReportMs: Int = 0,
|
||||
block: () -> T,
|
||||
): T =
|
||||
if (isDebug) {
|
||||
val (result, elapsed) = measureTimedValue(block)
|
||||
Log.d("DEBUG-TIME", "${elapsed.toString(DurationUnit.MILLISECONDS, 3).padStart(12)}: $debugMessage")
|
||||
if (elapsed.inWholeMilliseconds > minToReportMs) {
|
||||
Log.d("DEBUG-TIME", "${elapsed.toString(DurationUnit.MILLISECONDS, 3).padStart(12)}: $debugMessage")
|
||||
}
|
||||
result
|
||||
} else {
|
||||
block()
|
||||
|
@@ -30,7 +30,7 @@ class OkHttpClientFactory(
|
||||
keyCache: EncryptionKeyCache,
|
||||
) {
|
||||
companion object {
|
||||
// by picking a random proxy port, the connection will fail as it shouold.
|
||||
// by picking a random proxy port, the connection will fail as it should.
|
||||
const val DEFAULT_SOCKS_PORT: Int = 9050
|
||||
const val DEFAULT_IS_MOBILE: Boolean = false
|
||||
const val DEFAULT_TIMEOUT_ON_WIFI_SECS: Int = 10
|
||||
|
Reference in New Issue
Block a user