Skip to content

Commit 7080262

Browse files
replace println statements with Logger.info
1 parent b193f98 commit 7080262

File tree

6 files changed

+27
-24
lines changed

6 files changed

+27
-24
lines changed

android-kit-base/src/test/kotlin/com/mparticle/kits/KitIntegrationTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.Context
44
import android.util.SparseBooleanArray
55
import com.mparticle.MParticle
66
import com.mparticle.MParticle.IdentityType
7+
import com.mparticle.internal.Logger
78
import com.mparticle.internal.MPUtility
89
import com.mparticle.kits.KitIntegration.AttributeListener
910
import com.mparticle.mock.MockMParticle
@@ -55,7 +56,7 @@ class KitIntegrationTest {
5556
key: Int,
5657
valueIfKeyNotFound: Boolean,
5758
): Boolean {
58-
print("SparseArray getting: $key")
59+
Logger.verbose("SparseArray getting: $key")
5960
return if (map.containsKey(key)) {
6061
map[key]!!
6162
} else {

android-kit-base/src/test/kotlin/com/mparticle/kits/KitManagerImplTest.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.mparticle.identity.IdentityApi
2121
import com.mparticle.identity.IdentityApiResult
2222
import com.mparticle.identity.MParticleUser
2323
import com.mparticle.internal.CoreCallbacks
24+
import com.mparticle.internal.Logger
2425
import com.mparticle.internal.MPUtility
2526
import com.mparticle.internal.SideloadedKit
2627
import com.mparticle.kits.KitIntegration.AttributeListener
@@ -2261,35 +2262,35 @@ class KitManagerImplTest {
22612262
user: FilteredMParticleUser?,
22622263
config: RoktConfig?,
22632264
) {
2264-
println("Executed with $attributes")
2265+
Logger.info("Executed with $attributes")
22652266
}
22662267

22672268
override fun events(identifier: String): Flow<RoktEvent> {
2268-
println("events called with identfier: $identifier")
2269+
Logger.info("events called with identfier: $identifier")
22692270
return flowOf()
22702271
}
22712272

22722273
override fun enrichAttributes(
22732274
attributes: MutableMap<String, String>,
22742275
user: FilteredMParticleUser?,
22752276
) {
2276-
println("callRoktComposable with $attributes")
2277+
Logger.info("callRoktComposable with $attributes")
22772278
}
22782279

22792280
override fun setWrapperSdkVersion(wrapperSdkVersion: WrapperSdkVersion) {
2280-
println("setWrapperSdkVersion with $wrapperSdkVersion")
2281+
Logger.info("setWrapperSdkVersion with $wrapperSdkVersion")
22812282
}
22822283

22832284
override fun purchaseFinalized(
22842285
placementId: String,
22852286
catalogItemId: String,
22862287
status: Boolean,
22872288
) {
2288-
println("purchaseFinalized with placementId: $placementId catalogItemId : $catalogItemId status : $status ")
2289+
Logger.info("purchaseFinalized with placementId: $placementId catalogItemId : $catalogItemId status : $status ")
22892290
}
22902291

22912292
override fun close() {
2292-
println("close called")
2293+
Logger.info("close called")
22932294
}
22942295
}
22952296

testutils/src/main/java/com/mparticle/mock/MockKitConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public boolean get(int key) {
6868

6969
@Override
7070
public boolean get(int key, boolean valueIfKeyNotFound) {
71-
System.out.print("SparseArray getting: " + key);
71+
Logger.debug("SparseArray getting: " + key);
7272
if (map.containsKey(key)) {
7373
return map.get(key);
7474
} else {
@@ -98,4 +98,4 @@ public String toString() {
9898
return map.toString();
9999
}
100100
}
101-
}
101+
}

tooling/android-plugin/src/main/java/com/mparticle/MParticlePlugin.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ class MParticlePlugin : Plugin<Project> {
3939

4040
private val installTask: (Task) -> Unit = {
4141
if (isInstallTask) {
42-
println("installing MParticle ClI")
42+
Logger.verbose("installing MParticle ClI")
4343
val dataPlanningNodeApp = getDataplanningApp()
4444
if (dataPlanningNodeApp != null) {
4545
if (!dataPlanningNodeApp.checkNPMInstalled()) {
46-
println("MParticle requires NPM be installed. Please install NPM")
46+
Logger.verbose("MParticle requires NPM be installed. Please install NPM")
4747
} else if (dataPlanningNodeApp.checkMPInstalled()) {
48-
println("MParticle CLI tools aready installed")
48+
Logger.verbose("MParticle CLI tools aready installed")
4949
} else {
5050
val result = dataPlanningNodeApp.install()
51-
println("MParticle CLI result: \n${result.response}")
51+
Logger.verbose("MParticle CLI result: \n${result.response}")
5252
if (result.response == null || result.response?.contains("npm ERR") == true) {
53-
println("MParticle unable to install CLI tools.)")
53+
Logger.verbose("MParticle unable to install CLI tools.)")
5454
} else {
55-
println("MParticle CLI installed")
55+
Logger.verbose("MParticle CLI installed")
5656
}
5757
}
5858
}
@@ -62,15 +62,15 @@ class MParticlePlugin : Plugin<Project> {
6262

6363
private val uninstallTask: (Task) -> Unit = {
6464
if (isUninstallTask) {
65-
println("uninstalling MParticle CLI")
65+
Logger.verbose("uninstalling MParticle CLI")
6666
val dataPlanningNodeApp = getDataplanningApp()
6767
if (dataPlanningNodeApp != null) {
6868
val result = dataPlanningNodeApp.uninstall()
69-
println("MParticle CLI result: \n${result.response}")
69+
Logger.verbose("MParticle CLI result: \n${result.response}")
7070
if (result.response == null || result.response?.contains("npm ERR") ?: false) {
71-
println("MParticle unable to uninstall CLI tools. To do so manually, run \"npm uninstall @mparticle/cli\"")
71+
Logger.verbose("MParticle unable to uninstall CLI tools. To do so manually, run \"npm uninstall @mparticle/cli\"")
7272
} else {
73-
println("MParticle CLI uninstalled")
73+
Logger.verbose("MParticle CLI uninstalled")
7474
}
7575
}
7676
updateConfig(it.project)
@@ -105,17 +105,17 @@ class MParticlePlugin : Plugin<Project> {
105105
private fun updateArtifactPaths(config: Config) {
106106
val dataPlanningNodeApp = getDataplanningApp(true)
107107
if (dataPlanningNodeApp?.checkNodeInstalled() == false) {
108-
println("MParticle Node not installed. Please install to use Dataplanning features")
108+
Logger.verbose("MParticle Node not installed. Please install to use Dataplanning features")
109109
} else {
110110
val nodeLocation = arrayOf("type", "-p", "node").executeCLI().trim()
111111
Logger.verbose("node location = $nodeLocation")
112112
config.internalConfig.nodePath = nodeLocation
113113
}
114114
if (dataPlanningNodeApp?.checkNPMInstalled() == false) {
115-
println("MParticle NPM not installed. Please install to use Dataplanning features")
115+
Logger.verbose("MParticle NPM not installed. Please install to use Dataplanning features")
116116
}
117117
if (dataPlanningNodeApp?.checkMPInstalled() == false && !isInstallTask && !isUninstallTask) {
118-
println("MParticle CLI tools not installed. run \"./gradlew mpInstall\" to install")
118+
Logger.verbose("MParticle CLI tools not installed. run \"./gradlew mpInstall\" to install")
119119
} else {
120120
val location = arrayOf("type", "-p", "mp").executeCLI().trim()
121121
Logger.verbose("mp location = $location")

tooling/common/src/main/java/com/mparticle/tooling/DataPlanningNodeApp.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class DataPlanningNodeApp(
103103

104104
fun install(version: String? = null): NodeAppResult<String> {
105105
if (checkMPInstalled()) {
106-
println("MParticle CLI tools already installed")
106+
Logger.verbose("MParticle CLI tools already installed")
107107
}
108108
val packageString = "@mparticle/cli" + if (version != null) "@$version" else ""
109109
try {

tooling/custom-lint-rules/src/main/java/com/mparticle/lints/detectors/MpApiDetectorKt.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import com.android.tools.lint.detector.api.Scope
1313
import com.android.tools.lint.detector.api.Severity
1414
import com.android.tools.lint.detector.api.UastLintUtils.Companion.tryResolveUDeclaration
1515
import com.mparticle.lints.basedetectors.BaseDetector
16+
import com.mparticle.tooling.Logger
1617
import org.jetbrains.uast.UBlockExpression
1718
import org.jetbrains.uast.UCallExpression
1819
import org.jetbrains.uast.UClass
@@ -153,7 +154,7 @@ class MpApiDetectorKt :
153154
}
154155
}
155156
} catch (e: Exception) {
156-
e.printStackTrace()
157+
Logger.error(e?.toString() ?: "Unknown Exception")
157158
}
158159
}
159160
}

0 commit comments

Comments
 (0)