Improve logging output.

This commit is contained in:
Greyson Parrelli
2025-03-07 15:04:30 -05:00
parent e00d780115
commit caa1d0a2b3
2 changed files with 5 additions and 1 deletions

View File

@@ -26,7 +26,7 @@ object Scrubber {
private val E164_ZERO_PATTERN = Pattern.compile("\\b(KEEP_E164::)?0(\\d{10})\\b") private val E164_ZERO_PATTERN = Pattern.compile("\\b(KEEP_E164::)?0(\\d{10})\\b")
/** The second group will be censored.*/ /** The second group will be censored.*/
private val CRUDE_EMAIL_PATTERN = Pattern.compile("\\b([^\\s/])([^\\s/]*@[^\\s]+)") private val CRUDE_EMAIL_PATTERN = Pattern.compile("\\b([^\\s/,()])([^\\s/,()]*@[^\\s]+\\.[^\\s]+)")
private const val EMAIL_CENSOR = "...@..." private const val EMAIL_CENSOR = "...@..."
/** The middle group will be censored. */ /** The middle group will be censored. */

View File

@@ -106,6 +106,10 @@ class ScrubberTest(private val input: String, private val expected: String) {
"A short email a@def.com", "A short email a@def.com",
"A short email a...@..." "A short email a...@..."
), ),
arrayOf(
"This is not an email Success(result=org.whispersystems.signalservice.api.archive.ArchiveMediaResponse@1ea5e6)",
"This is not an email Success(result=org.whispersystems.signalservice.api.archive.ArchiveMediaResponse@1ea5e6)"
),
arrayOf( arrayOf(
"A email with multiple parts before the @ d.c+b.a@mulitpart.domain.com and a multipart domain", "A email with multiple parts before the @ d.c+b.a@mulitpart.domain.com and a multipart domain",
"A email with multiple parts before the @ d...@... and a multipart domain" "A email with multiple parts before the @ d...@... and a multipart domain"