Updated on 2026-08-14
This commit is contained in:
parent
ce86d3f87c
commit
0551a8f2fe
4 changed files with 77 additions and 2 deletions
|
|
@ -115,7 +115,8 @@ class AppLogsStore @Inject constructor(
|
|||
BufferedWriter(FileWriter(logFile, true)).use { writer ->
|
||||
writer.append(formatter.print(DateTime.now()))
|
||||
writer.append(": $tag ")
|
||||
messages.forEach(writer::append)
|
||||
messages.map(LogsSanitizer::sanitize)
|
||||
.forEach(writer::append)
|
||||
writer.newLine()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.tangem.datasource.local.logs
|
||||
|
||||
/**
|
||||
* Logs sanitizer
|
||||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
internal object LogsSanitizer {
|
||||
|
||||
private val HEX_REGEX = Regex("(0[xX])?(?:[A-Fa-f0-9]{2}-?){4,}")
|
||||
private const val HIDDEN_TEXT = "******"
|
||||
|
||||
fun sanitize(value: String): String {
|
||||
return HEX_REGEX.replace(input = value, replacement = HIDDEN_TEXT)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue