From 3bfcb89e3560bf59adcadfe1c4f82114a1f2baa2 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 25 May 2026 12:36:43 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../com/tangem/datasource/local/logs/AppLogsStore.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/datasource/src/main/java/com/tangem/datasource/local/logs/AppLogsStore.kt b/core/datasource/src/main/java/com/tangem/datasource/local/logs/AppLogsStore.kt index 1704e959a9..c9babc2291 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/local/logs/AppLogsStore.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/local/logs/AppLogsStore.kt @@ -1,6 +1,7 @@ package com.tangem.datasource.local.logs import android.content.Context +import com.tangem.datasource.BuildConfig import com.tangem.utils.coroutines.AppCoroutineScope import com.tangem.utils.coroutines.CoroutineDispatcherProvider import com.tangem.utils.logging.TangemLogger @@ -72,6 +73,8 @@ class AppLogsStore @Inject constructor( /** * Save log [message]. Pass [shouldSanitize] = false to bypass [LogsSanitizer]. + * Sanitization is also bypassed entirely when [BuildConfig.LOG_ENABLED] is true, + * so builds with logging enabled can expose raw values for testing. * The optional [throwable]'s stack trace is appended verbatim (never sanitized), * since stack traces routinely contain hex-like sequences that the sanitizer would * otherwise destroy. @@ -106,7 +109,11 @@ class AppLogsStore @Inject constructor( BufferedWriter(FileWriter(logFile, true)).use { writer -> writer.append(formatter.print(DateTime.now())) writer.append(": $tag ") - val processed = if (shouldSanitize) messages.map(LogsSanitizer::sanitize) else messages.toList() + val processed = if (shouldSanitize && !BuildConfig.LOG_ENABLED) { + messages.map(LogsSanitizer::sanitize) + } else { + messages.toList() + } processed.forEach(writer::append) if (throwable != null) { writer.newLine()