From 295d6188d592ff1b26e31fbef9363e9e4a7bd725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= <30429749+saleniuk@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:12:21 +0100 Subject: [PATCH] chore: fix tag logging for internal and staging flavors (#2739) --- .../com/wire/android/util/DataDogLogger.kt | 16 +++++++++------- .../com/wire/android/util/DataDogLogger.kt | 16 +++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/src/internal/kotlin/com/wire/android/util/DataDogLogger.kt b/app/src/internal/kotlin/com/wire/android/util/DataDogLogger.kt index 1cd511a3d5..055d776ff8 100644 --- a/app/src/internal/kotlin/com/wire/android/util/DataDogLogger.kt +++ b/app/src/internal/kotlin/com/wire/android/util/DataDogLogger.kt @@ -36,13 +36,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() - + 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) diff --git a/app/src/staging/kotlin/com/wire/android/util/DataDogLogger.kt b/app/src/staging/kotlin/com/wire/android/util/DataDogLogger.kt index 1cd511a3d5..055d776ff8 100644 --- a/app/src/staging/kotlin/com/wire/android/util/DataDogLogger.kt +++ b/app/src/staging/kotlin/com/wire/android/util/DataDogLogger.kt @@ -36,13 +36,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() - + 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)