Skip to content

Library for displaying logs of network requests.

Notifications You must be signed in to change notification settings

mertsalovda/NetLog

Repository files navigation

NetLog

Create a singleton repository instance. Example:

import android.app.Application
import ru.mertsalovda.netlog.interceptor.INetLogRepository
import ru.mertsalovda.netlog.repository.NetLogRepositoryImpl

class App : Application() {

    companion object {
        lateinit var netLogRepository: INetLogRepository
    }

    override fun onCreate() {
        super.onCreate()
        netLogRepository = NetLogRepositoryImpl()
    }
}

Create and add an interceptor to your OkHttpClient

   fun provideOkHttpClient(): OkHttpClient {
        return OkHttpClient.Builder()
                   .addInterceptor(NetLogInterceptor(App.netLogRepository))
                   .build()
    }

Create an instance of a NetLogDialogFragment and pass it a link to the repository with logs. Call the show method.

    NetLogDialogFragment.newInstance(App.netLogRepository).show(supportFragmentManager, "NetLog")

About

Library for displaying logs of network requests.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages