Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add server side logging configurations #358

Conversation

ShiCheng-Lu
Copy link
Contributor

@ShiCheng-Lu ShiCheng-Lu commented May 20, 2024

@ShiCheng-Lu ShiCheng-Lu marked this pull request as ready for review May 24, 2024 19:00
@ShiCheng-Lu ShiCheng-Lu requested a review from lmeier May 24, 2024 19:00
@ShiCheng-Lu ShiCheng-Lu force-pushed the shicheng/fence-1948-set-log-level-in-sdk-in-initialize branch 2 times, most recently from 832f6d8 to e95bf77 Compare June 11, 2024 14:50
@ShiCheng-Lu ShiCheng-Lu force-pushed the shicheng/fence-1948-set-log-level-in-sdk-in-initialize branch from e95bf77 to b23cdce Compare June 11, 2024 14:52
@ShiCheng-Lu ShiCheng-Lu force-pushed the shicheng/fence-1948-set-log-level-in-sdk-in-initialize branch from e119e90 to 4e006fe Compare June 11, 2024 18:43
@ShiCheng-Lu
Copy link
Contributor Author

I will remove the publish keys for testing if everything else looks good

@@ -130,6 +131,8 @@ internal class RadarApiClient(
if (usage != null) {
queryParams.append("&usage=${usage}")
}
val clientSdkConfiguration = RadarSettings.getClientSdkConfiguration(context).toString()
queryParams.append("&clientSdkConfiguration=${URLEncoder.encode(clientSdkConfiguration, "utf-8")}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to confirm this is consistent with the iOS encoding?
Also a GET request can technically have a body, would we want to utilize that here?

internal fun getLogLevel(context: Context): Radar.RadarLogLevel {
val logLevelInt = getSharedPreferences(context).getInt(KEY_LOG_LEVEL, 3)
val userDebug = getUserDebug(context)
return if (userDebug) Radar.RadarLogLevel.DEBUG else Radar.RadarLogLevel.fromInt(logLevelInt)
}

internal fun setLogLevel(context: Context, level: Radar.RadarLogLevel) {
val logLevelInt = level.value
getSharedPreferences(context).edit { putInt(KEY_LOG_LEVEL, logLevelInt) }
val sdkConfiguration = getClientSdkConfiguration(context)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echoing my sentiments from the ios PR, maybe move the syncing logic to the logger obj?

fun setSdkConfiguration(context: Context, configuration: RadarSdkConfiguration?) {
Radar.logger.d("set SDK Configuration | sdkConfiguration = $configuration")
if (configuration != null) {
getSharedPreferences(context).edit { putInt(KEY_LOG_LEVEL, configuration.logLevel.value) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to store the entire object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed for logLevel, added in the next PR

@ShiCheng-Lu ShiCheng-Lu closed this Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants