PurLog
A remote logging SDK for Native Android and Kotlin Multi Platform (Android, iOS, iPadOS, macOS, watchOS, tvOS).
Native Android Setup
Installation
dependencies {
implementation("io.metashark:purlog:0.9.0")
}
Permissions
<uses-permission android:name="android.permission.INTERNET" />
Native Android Example
Kotlin MultiPlatform Setup
Installation
commonMain.dependencies {
implementation("io.metashark:purlog:0.9.0")
}
Permissions
<uses-permission android:name="android.permission.INTERNET" />
Kotlin MultiPlatform Example
@Composable
@Preview
fun App() {
val context = getContext()
MaterialTheme {
val config = PurLogConfig.Builder()
.setEnv(PurLogEnv.DEV)
.setLevel(PurLogLevel.VERBOSE)
.setProject(
projectId = Secrets.projectId,
projectJWT = Secrets.projectJWT
)
.setContext(context)
.build()
CoroutineScope(Dispatchers.Default).launch {
PurLog.initialize(config)
PurLog.verbose(, metadata = mapOf( to ))
PurLog.debug()
PurLog.info()
PurLog.warn()
PurLog.error()
PurLog.fatal()
}
}
}
Note: Android environments require passing in a Context. setContext(context) can be ommited if only iOS is targeted
commonMain
@Composable
expect fun getContext(): Any?
androidMain
import androidx.compose.ui.platform.LocalContext
@Composable
actual fun getContext(): Any? = LocalContext.current
iosMain
@Composable
actual fun getContext(): Any? = null