Skip to content

Commit

Permalink
chore: fix tag logging (#2733)
Browse files Browse the repository at this point in the history
Co-authored-by: Vitor Hugo Schwaab <[email protected]>
Co-authored-by: MohamadJaara <[email protected]>
Co-authored-by: Yamil Medina <[email protected]>
  • Loading branch information
4 people authored Feb 23, 2024
1 parent e9cd1a9 commit 216ee5b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/src/beta/kotlin/com/wire/android/util/DataDogLogger.kt
Original file line number Diff line number Diff line change
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

0 comments on commit 216ee5b

Please sign in to comment.