Log with Timber.
This commit is contained in:
parent
4136ba94e5
commit
9bf7c1ccf8
3 changed files with 6 additions and 6 deletions
|
|
@ -1,10 +1,10 @@
|
|||
package io.element.android.x.core.compose
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.runtime.remember
|
||||
import io.element.android.x.core.BuildConfig
|
||||
import timber.log.Timber
|
||||
|
||||
// Note the inline function below which ensures that this function is essentially
|
||||
// copied at the call site to ensure that its logging only recompositions from the
|
||||
|
|
@ -14,7 +14,7 @@ fun LogCompositions(tag: String, msg: String) {
|
|||
if (BuildConfig.DEBUG) {
|
||||
val ref = remember { Ref(0) }
|
||||
SideEffect { ref.value++ }
|
||||
Log.d(tag, "Compositions: $msg ${ref.value}")
|
||||
Timber.d(tag, "Compositions: $msg ${ref.value}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
package io.element.android.x.core.data
|
||||
|
||||
import android.util.Log
|
||||
import timber.log.Timber
|
||||
|
||||
inline fun <A> tryOrNull(message: String? = null, operation: () -> A): A? {
|
||||
return try {
|
||||
operation()
|
||||
} catch (any: Throwable) {
|
||||
if (message != null) {
|
||||
Log.e("TAG", message, any)
|
||||
Timber.e("TAG", message, any)
|
||||
}
|
||||
null
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue