mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-30 18:32:31 +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(
|
inline fun <T> logTime(
|
||||||
debugMessage: String,
|
debugMessage: String,
|
||||||
|
minToReportMs: Int = 0,
|
||||||
block: () -> T,
|
block: () -> T,
|
||||||
): T =
|
): T =
|
||||||
if (isDebug) {
|
if (isDebug) {
|
||||||
val (result, elapsed) = measureTimedValue(block)
|
val (result, elapsed) = measureTimedValue(block)
|
||||||
|
if (elapsed.inWholeMilliseconds > minToReportMs) {
|
||||||
Log.d("DEBUG-TIME", "${elapsed.toString(DurationUnit.MILLISECONDS, 3).padStart(12)}: $debugMessage")
|
Log.d("DEBUG-TIME", "${elapsed.toString(DurationUnit.MILLISECONDS, 3).padStart(12)}: $debugMessage")
|
||||||
|
}
|
||||||
result
|
result
|
||||||
} else {
|
} else {
|
||||||
block()
|
block()
|
||||||
|
@@ -30,7 +30,7 @@ class OkHttpClientFactory(
|
|||||||
keyCache: EncryptionKeyCache,
|
keyCache: EncryptionKeyCache,
|
||||||
) {
|
) {
|
||||||
companion object {
|
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_SOCKS_PORT: Int = 9050
|
||||||
const val DEFAULT_IS_MOBILE: Boolean = false
|
const val DEFAULT_IS_MOBILE: Boolean = false
|
||||||
const val DEFAULT_TIMEOUT_ON_WIFI_SECS: Int = 10
|
const val DEFAULT_TIMEOUT_ON_WIFI_SECS: Int = 10
|
||||||
|
Reference in New Issue
Block a user