Created
August 30, 2018 22:58
-
-
Save adrianhall/5bc0fb2fecbcc9a469a7f9555652afab to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class LocalAnalyticsService : AnalyticsService { | |
override fun recordEvent(eventName: String, attributes: Map<String,String>?, metrics: Map<String,Double>?) { | |
val event = StringBuilder("") | |
attributes?.let { | |
for ((k, v) in it) { event.append(", $k=\"$v\"") } | |
} | |
metrics?.let { | |
for ((k, v) in it) { event.append(", $k=${String.format("%.2f",v)}") } | |
} | |
if (event.isNotEmpty()) | |
event[0] = ':' | |
Log.v(TAG, "recordEvent($eventName)$event") | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment