-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from Parsely/use_android_logging
Use `android.util.Log` for logging
- Loading branch information
Showing
12 changed files
with
66 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.parsely.parselyandroid | ||
|
||
import android.util.Log as AndroidLog | ||
|
||
internal object AndroidLogWrapper : Log { | ||
|
||
private const val TAG = "Parsely" | ||
|
||
override fun i(message: String) { | ||
AndroidLog.i(TAG, message) | ||
} | ||
|
||
override fun d(message: String) { | ||
AndroidLog.d(TAG, message) | ||
} | ||
|
||
override fun e(message: String, throwable: Throwable?) { | ||
AndroidLog.e(TAG, message, throwable) | ||
} | ||
} | ||
|
||
internal interface Log { | ||
fun i(message: String) | ||
fun d(message: String) | ||
fun e(message: String, throwable: Throwable?) | ||
|
||
companion object { | ||
var instance: Log = AndroidLogWrapper | ||
|
||
fun i(message: String) = instance.i(message) | ||
fun d(message: String) = instance.d(message) | ||
fun e(message: String, throwable: Throwable? = null) = instance.e(message, throwable) | ||
} | ||
} |
17 changes: 0 additions & 17 deletions
17
parsely/src/main/java/com/parsely/parselyandroid/Logging.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ internal class EventsBuilderTest { | |
TEST_SITE_ID, | ||
clock | ||
) | ||
Log.instance = FakeLog | ||
} | ||
|
||
@Test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.parsely.parselyandroid | ||
|
||
internal object FakeLog : Log { | ||
override fun i(message: String) = println(message) | ||
override fun d(message: String) = println(message) | ||
override fun e(message: String, throwable: Throwable?) = println(message + throwable?.message) | ||
} |