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

[AND-418] Initialize StreamLog only on the case it wasn't initialized outside #1336

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,7 @@ public class StreamVideoBuilder @JvmOverloads constructor(
user = user.copy(role = "user")
}

// Initialize Stream internal loggers
StreamLog.install(AndroidStreamLogger())
StreamLog.setValidator { priority, _ -> priority.level >= loggingLevel.priority.level }
setupStreamLog()

// Android JSR-310 backport backport
AndroidThreeTen.init(context)
Expand Down Expand Up @@ -249,7 +247,6 @@ public class StreamVideoBuilder @JvmOverloads constructor(
apiKey = apiKey,
token = token,
tokenProvider = tokenProvider,
loggingLevel = loggingLevel,
lifecycle = lifecycle,
coordinatorConnectionModule = coordinatorConnectionModule,
streamNotificationManager = streamNotificationManager,
Expand Down Expand Up @@ -304,6 +301,14 @@ public class StreamVideoBuilder @JvmOverloads constructor(
return client
}

private fun setupStreamLog() {
if (!StreamLog.isInstalled) {
// Initialize Stream internal loggers
StreamLog.install(AndroidStreamLogger())
StreamLog.setValidator { priority, _ -> priority.level >= loggingLevel.priority.level }
}
}

internal fun createCallConfigurationRegistry(
callServiceConfigRegistry: CallServiceConfigRegistry? = null,
callServiceConfig: CallServiceConfig? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ import io.getstream.video.android.core.events.VideoEventListener
import io.getstream.video.android.core.filter.Filters
import io.getstream.video.android.core.filter.toMap
import io.getstream.video.android.core.internal.module.CoordinatorConnectionModule
import io.getstream.video.android.core.logging.LoggingLevel
import io.getstream.video.android.core.model.EdgeData
import io.getstream.video.android.core.model.MuteUsersData
import io.getstream.video.android.core.model.QueriedCalls
Expand Down Expand Up @@ -148,7 +147,6 @@ internal class StreamVideoClient internal constructor(
internal val apiKey: ApiKey,
internal var token: String,
private val lifecycle: Lifecycle,
private val loggingLevel: LoggingLevel,
internal val coordinatorConnectionModule: CoordinatorConnectionModule,
internal val tokenProvider: TokenProvider = ConstantTokenProvider(token),
internal val streamNotificationManager: StreamNotificationManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import android.net.ConnectivityManager
import androidx.lifecycle.Lifecycle
import io.getstream.android.video.generated.apis.ProductvideoApi
import io.getstream.android.video.generated.infrastructure.Serializer
import io.getstream.log.streamLog
import io.getstream.video.android.core.header.HeadersUtil
import io.getstream.video.android.core.internal.network.NetworkStateProvider
import io.getstream.video.android.core.logging.LoggingLevel
Expand Down Expand Up @@ -69,7 +70,9 @@ internal class CoordinatorConnectionModule(
HeadersInterceptor(HeadersUtil()),
)
.addInterceptor(authInterceptor).addInterceptor(
HttpLoggingInterceptor().apply {
HttpLoggingInterceptor {
streamLog(tag = "Video:Http") { it }
}.apply {
level = loggingLevel.httpLoggingLevel.level
},
).retryOnConnectionFailure(true)
Expand Down
Loading