Skip to content
Snippets Groups Projects
Unverified Commit f5e6b1c3 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Force specific log tags in a few instances (#1249)

parent a301cbe8
No related branches found
No related tags found
No related merge requests found
...@@ -148,6 +148,7 @@ object RetrieveDiagnosisKeysTransaction : Transaction() { ...@@ -148,6 +148,7 @@ object RetrieveDiagnosisKeysTransaction : Transaction() {
if (LocalData.lastTimeDiagnosisKeysFromServerFetch() == null || if (LocalData.lastTimeDiagnosisKeysFromServerFetch() == null ||
currentDate.withTimeAtStartOfDay() != lastFetch.withTimeAtStartOfDay() currentDate.withTimeAtStartOfDay() != lastFetch.withTimeAtStartOfDay()
) { ) {
Timber.tag(TAG).d("No keys fetched today yet (last=%s, now=%s)", lastFetch, currentDate)
BackgroundWorkHelper.sendDebugNotification( BackgroundWorkHelper.sendDebugNotification(
"Start RetrieveDiagnosisKeysTransaction", "Start RetrieveDiagnosisKeysTransaction",
"No keys fetched today yet \n${DateTime.now()}\nUTC: $currentDate" "No keys fetched today yet \n${DateTime.now()}\nUTC: $currentDate"
......
...@@ -140,9 +140,9 @@ class TracingViewModel : ViewModel() { ...@@ -140,9 +140,9 @@ class TracingViewModel : ViewModel() {
val isBackgroundJobEnabled = val isBackgroundJobEnabled =
ConnectivityHelper.autoModeEnabled(CoronaWarnApplication.getAppContext()) ConnectivityHelper.autoModeEnabled(CoronaWarnApplication.getAppContext())
Timber.v("Keys were not retrieved today $keysWereNotRetrievedToday") Timber.tag(TAG).v("Keys were not retrieved today $keysWereNotRetrievedToday")
Timber.v("Network is enabled $isNetworkEnabled") Timber.tag(TAG).v("Network is enabled $isNetworkEnabled")
Timber.v("Background jobs are enabled $isBackgroundJobEnabled") Timber.tag(TAG).v("Background jobs are enabled $isBackgroundJobEnabled")
if (keysWereNotRetrievedToday && isNetworkEnabled && isBackgroundJobEnabled) { if (keysWereNotRetrievedToday && isNetworkEnabled && isBackgroundJobEnabled) {
TracingRepository.isRefreshing.value = true TracingRepository.isRefreshing.value = true
...@@ -219,7 +219,7 @@ class TracingViewModel : ViewModel() { ...@@ -219,7 +219,7 @@ class TracingViewModel : ViewModel() {
ExposureSummaryRepository.getExposureSummaryRepository() ExposureSummaryRepository.getExposureSummaryRepository()
.getLatestExposureSummary(token) .getLatestExposureSummary(token)
} }
Timber.v("retrieved latest exposure summary from db") Timber.tag(TAG).v("retrieved latest exposure summary from db")
} catch (e: Exception) { } catch (e: Exception) {
e.report( e.report(
de.rki.coronawarnapp.exception.ExceptionCategory.EXPOSURENOTIFICATION, de.rki.coronawarnapp.exception.ExceptionCategory.EXPOSURENOTIFICATION,
......
...@@ -15,6 +15,7 @@ import javax.inject.Singleton ...@@ -15,6 +15,7 @@ import javax.inject.Singleton
class VerificationKeys @Inject constructor() { class VerificationKeys @Inject constructor() {
companion object { companion object {
private const val KEY_DELIMITER = "," private const val KEY_DELIMITER = ","
private val TAG = VerificationKeys::class.java.simpleName
} }
private val keyFactory = KeyFactory.getInstance(KeyProperties.KEY_ALGORITHM_EC) private val keyFactory = KeyFactory.getInstance(KeyProperties.KEY_ALGORITHM_EC)
...@@ -28,8 +29,8 @@ class VerificationKeys @Inject constructor() { ...@@ -28,8 +29,8 @@ class VerificationKeys @Inject constructor() {
signature.getValidSignaturesForExport(export, signatureListBinary) signature.getValidSignaturesForExport(export, signatureListBinary)
.isEmpty() .isEmpty()
.also { .also {
if (it) Timber.d("export is invalid") if (it) Timber.tag(TAG).d("export is invalid")
else Timber.d("export is valid") else Timber.tag(TAG).d("export is valid")
} }
} }
...@@ -46,20 +47,20 @@ class VerificationKeys @Inject constructor() { ...@@ -46,20 +47,20 @@ class VerificationKeys @Inject constructor() {
} }
verified verified
} }
.also { Timber.v("${it.size} valid signatures found") } .also { Timber.tag(TAG).v("${it.size} valid signatures found") }
private fun getKeysForSignatureVerificationFilteredByEnvironment() = private fun getKeysForSignatureVerificationFilteredByEnvironment() =
BuildConfig.PUB_KEYS_SIGNATURE_VERIFICATION.split(KEY_DELIMITER) BuildConfig.PUB_KEYS_SIGNATURE_VERIFICATION.split(KEY_DELIMITER)
.mapNotNull { delimitedString -> .mapNotNull { delimitedString ->
Base64.decode(delimitedString, Base64.DEFAULT) Base64.decode(delimitedString, Base64.DEFAULT)
}.map { binaryPublicKey -> }.map { binaryPublicKey ->
keyFactory.generatePublic( keyFactory.generatePublic(
X509EncodedKeySpec( X509EncodedKeySpec(
binaryPublicKey binaryPublicKey
)
) )
) }
} .onEach { Timber.tag(TAG).v("$it") }
.onEach { Timber.v("$it") }
private fun getTEKSignaturesForEnvironment( private fun getTEKSignaturesForEnvironment(
signatureListBinary: ByteArray? signatureListBinary: ByteArray?
...@@ -67,6 +68,6 @@ class VerificationKeys @Inject constructor() { ...@@ -67,6 +68,6 @@ class VerificationKeys @Inject constructor() {
.parseFrom(signatureListBinary) .parseFrom(signatureListBinary)
.signaturesList .signaturesList
.asSequence() .asSequence()
.onEach { Timber.v(it.toString()) } .onEach { Timber.tag(TAG).v(it.toString()) }
.mapNotNull { it.signature.toByteArray() } .mapNotNull { it.signature.toByteArray() }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment