Skip to content

Commit 0d204f5

Browse files
committed
Share tag with other modules.
1 parent 2e9cc25 commit 0d204f5

File tree

15 files changed

+16
-49
lines changed

15 files changed

+16
-49
lines changed

libraries/core/src/main/kotlin/io/element/android/libraries/core/log/logger/LoggerTag.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ package io.element.android.libraries.core.log.logger
2424
*/
2525
open class LoggerTag(name: String, parentTag: LoggerTag? = null) {
2626

27-
object SYNC : LoggerTag("SYNC")
28-
object VOIP : LoggerTag("VOIP")
29-
object CRYPTO : LoggerTag("CRYPTO")
30-
object RENDEZVOUS : LoggerTag("RZ")
27+
object PushLoggerTag : LoggerTag("Push")
28+
object NotificationLoggerTag : LoggerTag("Notification", PushLoggerTag)
3129

3230
val value: String = if (parentTag == null) {
3331
name

libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/PushersManager.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import io.element.android.libraries.matrix.api.core.EventId
2424
import io.element.android.libraries.matrix.api.core.SessionId
2525
import io.element.android.libraries.matrix.api.pusher.SetHttpPusherData
2626
import io.element.android.libraries.push.impl.config.PushConfig
27-
import io.element.android.libraries.push.impl.log.pushLoggerTag
2827
import io.element.android.libraries.push.impl.pushgateway.PushGatewayNotifyRequest
2928
import io.element.android.libraries.pushproviders.api.PusherSubscriber
3029
import io.element.android.libraries.pushstore.api.UserPushStoreFactory
@@ -35,7 +34,7 @@ import javax.inject.Inject
3534

3635
internal const val DEFAULT_PUSHER_FILE_TAG = "mobile"
3736

38-
private val loggerTag = LoggerTag("PushersManager", pushLoggerTag)
37+
private val loggerTag = LoggerTag("PushersManager", LoggerTag.PushLoggerTag)
3938

4039
@ContributesBinding(AppScope::class)
4140
class PushersManager @Inject constructor(

libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/log/LoggerTag.kt

Lines changed: 0 additions & 22 deletions
This file was deleted.

libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManager.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import io.element.android.libraries.matrix.api.core.SessionId
3131
import io.element.android.libraries.matrix.api.core.ThreadId
3232
import io.element.android.libraries.matrix.api.user.MatrixUser
3333
import io.element.android.libraries.push.api.notifications.NotificationDrawerManager
34-
import io.element.android.libraries.push.impl.log.notificationLoggerTag
3534
import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent
3635
import io.element.android.services.appnavstate.api.AppNavigationStateService
3736
import io.element.android.services.appnavstate.api.NavigationState
@@ -43,7 +42,7 @@ import kotlinx.coroutines.withContext
4342
import timber.log.Timber
4443
import javax.inject.Inject
4544

46-
private val loggerTag = LoggerTag("DefaultNotificationDrawerManager", notificationLoggerTag)
45+
private val loggerTag = LoggerTag("DefaultNotificationDrawerManager", LoggerTag.NotificationLoggerTag)
4746

4847
/**
4948
* The NotificationDrawerManager receives notification events as they arrived (from event stream or fcm) and

libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventProcessor.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package io.element.android.libraries.push.impl.notifications
1818

1919
import io.element.android.libraries.core.log.logger.LoggerTag
2020
import io.element.android.libraries.matrix.api.timeline.item.event.EventType
21-
import io.element.android.libraries.push.impl.log.notificationLoggerTag
2221
import io.element.android.libraries.push.impl.notifications.model.FallbackNotifiableEvent
2322
import io.element.android.libraries.push.impl.notifications.model.InviteNotifiableEvent
2423
import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent
@@ -31,7 +30,7 @@ import javax.inject.Inject
3130

3231
private typealias ProcessedEvents = List<ProcessedEvent<NotifiableEvent>>
3332

34-
private val loggerTag = LoggerTag("NotifiableEventProcessor", notificationLoggerTag)
33+
private val loggerTag = LoggerTag("NotifiableEventProcessor", LoggerTag.NotificationLoggerTag)
3534

3635
class NotifiableEventProcessor @Inject constructor(
3736
private val outdatedDetector: OutdatedEventDetector,

libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventResolver.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import io.element.android.libraries.matrix.api.timeline.item.event.TextMessageTy
3636
import io.element.android.libraries.matrix.api.timeline.item.event.UnknownMessageType
3737
import io.element.android.libraries.matrix.api.timeline.item.event.VideoMessageType
3838
import io.element.android.libraries.push.impl.R
39-
import io.element.android.libraries.push.impl.log.notificationLoggerTag
4039
import io.element.android.libraries.push.impl.notifications.model.FallbackNotifiableEvent
4140
import io.element.android.libraries.push.impl.notifications.model.InviteNotifiableEvent
4241
import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent
@@ -47,7 +46,7 @@ import io.element.android.services.toolbox.api.systemclock.SystemClock
4746
import timber.log.Timber
4847
import javax.inject.Inject
4948

50-
private val loggerTag = LoggerTag("NotifiableEventResolver", notificationLoggerTag)
49+
private val loggerTag = LoggerTag("NotifiableEventResolver", LoggerTag.NotificationLoggerTag)
5150

5251
/**
5352
* The notifiable event resolver is able to create a NotifiableEvent (view model for notifications) from an sdk Event.

libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationBroadcastReceiver.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ import io.element.android.libraries.core.log.logger.LoggerTag
2424
import io.element.android.libraries.matrix.api.core.EventId
2525
import io.element.android.libraries.matrix.api.core.RoomId
2626
import io.element.android.libraries.matrix.api.core.SessionId
27-
import io.element.android.libraries.push.impl.log.notificationLoggerTag
2827
import timber.log.Timber
2928
import javax.inject.Inject
3029

31-
private val loggerTag = LoggerTag("NotificationBroadcastReceiver", notificationLoggerTag)
30+
private val loggerTag = LoggerTag("NotificationBroadcastReceiver", LoggerTag.NotificationLoggerTag)
3231

3332
/**
3433
* Receives actions broadcast by notification (on click, on dismiss, inline replies, etc.).
@@ -41,11 +40,10 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
4140
override fun onReceive(context: Context?, intent: Intent?) {
4241
if (intent == null || context == null) return
4342
context.bindings<NotificationBroadcastReceiverBindings>().inject(this)
44-
Timber.tag(loggerTag.value).d("received: ${intent.action} ${intent.data}")
4543
val sessionId = intent.extras?.getString(KEY_SESSION_ID)?.let(::SessionId) ?: return
4644
val roomId = intent.getStringExtra(KEY_ROOM_ID)?.let(::RoomId)
4745
val eventId = intent.getStringExtra(KEY_EVENT_ID)?.let(::EventId)
48-
Timber.tag(loggerTag.value).d("received for: ${roomId?.value}/${eventId?.value}")
46+
Timber.tag(loggerTag.value).d("onReceive: ${intent.action} ${intent.data} for: ${roomId?.value}/${eventId?.value}")
4947
when (intent.action) {
5048
actionIds.smartReply ->
5149
handleSmartReply(intent, context)

libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationEventPersistence.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import io.element.android.libraries.androidutils.file.safeDelete
2222
import io.element.android.libraries.core.data.tryOrNull
2323
import io.element.android.libraries.core.log.logger.LoggerTag
2424
import io.element.android.libraries.di.ApplicationContext
25-
import io.element.android.libraries.push.impl.log.notificationLoggerTag
2625
import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent
2726
import timber.log.Timber
2827
import java.io.File
@@ -33,7 +32,7 @@ import javax.inject.Inject
3332
private const val ROOMS_NOTIFICATIONS_FILE_NAME_LEGACY = "im.vector.notifications.cache"
3433
private const val FILE_NAME = "notifications.bin"
3534

36-
private val loggerTag = LoggerTag("NotificationEventPersistence", notificationLoggerTag)
35+
private val loggerTag = LoggerTag("NotificationEventPersistence", LoggerTag.NotificationLoggerTag)
3736

3837
class NotificationEventPersistence @Inject constructor(
3938
@ApplicationContext private val context: Context,

libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotificationRenderer.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package io.element.android.libraries.push.impl.notifications
1919
import io.element.android.libraries.core.log.logger.LoggerTag
2020
import io.element.android.libraries.matrix.api.core.RoomId
2121
import io.element.android.libraries.matrix.api.user.MatrixUser
22-
import io.element.android.libraries.push.impl.log.notificationLoggerTag
2322
import io.element.android.libraries.push.impl.notifications.model.FallbackNotifiableEvent
2423
import io.element.android.libraries.push.impl.notifications.model.InviteNotifiableEvent
2524
import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent
@@ -28,7 +27,7 @@ import io.element.android.libraries.push.impl.notifications.model.SimpleNotifiab
2827
import timber.log.Timber
2928
import javax.inject.Inject
3029

31-
private val loggerTag = LoggerTag("NotificationRenderer", notificationLoggerTag)
30+
private val loggerTag = LoggerTag("NotificationRenderer", LoggerTag.NotificationLoggerTag)
3231

3332
class NotificationRenderer @Inject constructor(
3433
private val notificationIdProvider: NotificationIdProvider,

libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/push/DefaultPushHandler.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import io.element.android.libraries.core.meta.BuildMeta
2424
import io.element.android.libraries.di.AppScope
2525
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
2626
import io.element.android.libraries.push.impl.PushersManager
27-
import io.element.android.libraries.push.impl.log.pushLoggerTag
2827
import io.element.android.libraries.push.impl.notifications.DefaultNotificationDrawerManager
2928
import io.element.android.libraries.push.impl.notifications.NotifiableEventResolver
3029
import io.element.android.libraries.push.impl.store.DefaultPushDataStore
@@ -40,7 +39,7 @@ import kotlinx.coroutines.launch
4039
import timber.log.Timber
4140
import javax.inject.Inject
4241

43-
private val loggerTag = LoggerTag("PushHandler", pushLoggerTag)
42+
private val loggerTag = LoggerTag("PushHandler", LoggerTag.PushLoggerTag)
4443

4544
@ContributesBinding(AppScope::class)
4645
class DefaultPushHandler @Inject constructor(

0 commit comments

Comments
 (0)