Skip to content

Commit

Permalink
chore: fix tag logging (#2730)
Browse files Browse the repository at this point in the history
Co-authored-by: MohamadJaara <mohamad.jaara@wire.com>
  • Loading branch information
vitorhugods and MohamadJaara committed Feb 23, 2024
1 parent 1ab45c9 commit 63fd841
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
16 changes: 9 additions & 7 deletions app/src/beta/kotlin/com/wire/android/util/DataDogLogger.kt
Expand Up @@ -34,13 +34,15 @@ object DataDogLogger : LogWriter() {
.build()

override fun log(severity: Severity, message: String, tag: String, throwable: Throwable?) {
val attributes = KaliumLogger.UserClientData.getFromTag(tag)?.let { userClientData ->
mapOf(
"userId" to userClientData.userId,
"clientId" to userClientData.clientId,
)
} ?: emptyMap<String, Any?>()

val logInfo = KaliumLogger.LogAttributes.getInfoFromTagString(tag)
val userAccountData = mapOf(
"userId" to logInfo.userClientData?.userId,
"clientId" to logInfo.userClientData?.clientId,
)
val attributes = mapOf(
"wireAccount" to userAccountData,
"tag" to logInfo.textTag
)
when (severity) {
Severity.Debug -> logger.d(message, throwable, attributes)
Severity.Info -> logger.i(message, throwable, attributes)
Expand Down
Expand Up @@ -23,7 +23,6 @@ import androidx.compose.runtime.setValue
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.wire.android.appLogger
import com.wire.android.ui.home.conversations.ConversationNavArgs
import com.wire.android.ui.home.conversations.usecase.ObserveUsersTypingInConversationUseCase
import com.wire.android.ui.navArgs
Expand Down

0 comments on commit 63fd841

Please sign in to comment.