Skip to content

Commit

Permalink
improved loglevel parsing android
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 committed Oct 16, 2024
1 parent 0c04fcc commit bc82864
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ class CustomerIOReactNativeModule(
Keys.Config.CDP_API_KEY
) ?: throw IllegalArgumentException("CDP API Key is required to initialize Customer.io")

val logLevelRawValue = packageConfig.getTypedValue<String>(Keys.Config.LOG_LEVEL)
val regionRawValue = packageConfig.getTypedValue<String>(Keys.Config.REGION)
val region = regionRawValue.let { Region.getRegion(it) }

CustomerIOBuilder(
applicationContext = reactApplicationContext.applicationContext as Application,
cdpApiKey = cdpApiKey
).apply {
logLevel(CioLogLevel.getLogLevel(packageConfig.getTypedValue<String>(Keys.Config.LOG_LEVEL)))
logLevelRawValue?.let { logLevel(CioLogLevel.getLogLevel(it)) }
regionRawValue?.let { region(region) }

packageConfig.getTypedValue<Boolean>(Keys.Config.AUTO_TRACK_DEVICE_ATTRIBUTES)
Expand Down

0 comments on commit bc82864

Please sign in to comment.