Skip to content

Commit 60c6b80

Browse files
committed
Use Logger class for logging
1 parent 0ecd509 commit 60c6b80

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

android/src/newarch/java/com/mparticle/react/rokt/MPRoktModule.kt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.mparticle.react.rokt
22

3-
import android.util.Log
43
import com.facebook.react.bridge.ReactApplicationContext
54
import com.facebook.react.bridge.ReactMethod
65
import com.facebook.react.bridge.ReadableMap
@@ -11,6 +10,7 @@ import com.mparticle.MParticle
1110
import com.mparticle.WrapperSdk
1211
import com.mparticle.react.NativeMPRoktSpec
1312
import com.mparticle.rokt.RoktEmbeddedView
13+
import com.mparticle.internal.Logger
1414
import java.lang.ref.WeakReference
1515
import java.util.concurrent.CountDownLatch
1616

@@ -21,10 +21,6 @@ class MPRoktModule(
2121
MParticle.getInstance()?.setWrapperSdk(WrapperSdk.WrapperSdkReactNative, "")
2222
}
2323

24-
companion object {
25-
private const val TAG = "MPRoktModule"
26-
}
27-
2824
private val impl = MPRoktModuleImpl(reactContext)
2925

3026
override fun getName(): String = impl.getName()
@@ -38,7 +34,7 @@ class MPRoktModule(
3834
fontFilesMap: ReadableMap?,
3935
) {
4036
if (identifier.isBlank()) {
41-
Log.w(TAG, "selectPlacements failed. identifier cannot be empty")
37+
Logger.warning("selectPlacements failed. identifier cannot be empty")
4238
return
4339
}
4440
MParticle.getInstance()?.Rokt()?.events(identifier)?.let {
@@ -85,7 +81,7 @@ class MPRoktModule(
8581
placeholders.getDouble(key).toInt()
8682

8783
else -> {
88-
Log.w(TAG, "Invalid view tag for key: $key")
84+
Logger.warning("Invalid view tag for key: $key")
8985
continue
9086
}
9187
}
@@ -94,20 +90,20 @@ class MPRoktModule(
9490
val uiManager =
9591
UIManagerHelper.getUIManagerForReactTag(reactContext, reactTag)
9692
if (uiManager == null) {
97-
Log.w(TAG, "UIManager not found for tag: $reactTag")
93+
Logger.warning("UIManager not found for tag: $reactTag")
9894
continue
9995
}
10096

10197
// Resolve the view using the manager (now on UI thread)
10298
val view = uiManager.resolveView(reactTag)
10399
if (view is RoktEmbeddedView) {
104100
placeholdersMap[key] = WeakReference(view)
105-
Log.d(TAG, "Successfully found Widget for key: $key with tag: $reactTag")
101+
Logger.debug("Successfully found Widget for key: $key with tag: $reactTag")
106102
} else {
107-
Log.w(TAG, "View with tag $reactTag is not a Widget: ${view?.javaClass?.simpleName}")
103+
Logger.warning("View with tag $reactTag is not a Widget: ${view?.javaClass?.simpleName}")
108104
}
109105
} catch (e: Exception) {
110-
Log.w(TAG, "Error processing placeholder for key $key: ${e.message}")
106+
Logger.warning("Error processing placeholder for key $key: ${e.message}")
111107
e.printStackTrace()
112108
}
113109
}
@@ -120,7 +116,7 @@ class MPRoktModule(
120116
// Wait for UI thread to finish processing
121117
latch.await()
122118
} catch (e: InterruptedException) {
123-
Log.w(TAG, "Interrupted while waiting for UI thread: ${e.message}")
119+
Logger.warning("Interrupted while waiting for UI thread: ${e.message}")
124120
}
125121
}
126122

android/src/oldarch/java/com/mparticle/react/rokt/MPRoktModule.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.facebook.react.uimanager.NativeViewHierarchyManager
77
import com.facebook.react.uimanager.UIManagerModule
88
import com.mparticle.MParticle
99
import com.mparticle.WrapperSdk
10+
import com.mparticle.internal.Logger
1011
import com.mparticle.react.NativeMPRoktSpec
1112
import com.mparticle.rokt.RoktEmbeddedView
1213
import java.lang.ref.WeakReference
@@ -31,6 +32,7 @@ class MPRoktModule(
3132
fontFilesMap: ReadableMap?,
3233
) {
3334
if (identifier.isBlank()) {
35+
Logger.warning("selectPlacements failed. identifier cannot be empty")
3436
return
3537
}
3638
val uiManager = reactContext.getNativeModule(UIManagerModule::class.java)

0 commit comments

Comments
 (0)