Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix tag logging for internal and staging flavors #2739

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: fix tag logging for other flavors (internal, staging)
  • Loading branch information
saleniuk committed Feb 26, 2024
commit 36c68f4a90e3ed800b56ed2bcc8a28116b67780f
16 changes: 9 additions & 7 deletions app/src/internal/kotlin/com/wire/android/util/DataDogLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<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
16 changes: 9 additions & 7 deletions app/src/staging/kotlin/com/wire/android/util/DataDogLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<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
Loading