์ฑ ๊ฐ๋ฐ์ Log.d ๋ณด์ง ์๊ณ BottomSheetDialog ๋ก ๊ฐ๋จํ๊ฒ ๋ณผ์ ์๋ ๊ฐ๋ฐ์ฉ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋๋ค.
์๋๋ก์ด๋ HTTP ํต์ ์ Netty๋ก ์ฌ์ฉํ๋ค๋ฉด...๋น ๋ฅด๊ฒ ๋ค๋ก๊ฐ๊ธฐ๋ฅผ ๋๋ฌ์ฃผ์ธ์ ๐ญ
์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ OkHttp3 ๊ธฐ์ค์ผ๋ก ๋์ํฉ๋๋ค.
์ฑ์ ์ฌ์ฉํ๋ค๊ฐ ๋จ๋ง๊ธฐ๋ฅผ ํ๋ค๋ฉด ํธ๋ํนํ ๋ก๊ทธ๋ค์ ๊ฐ๋จํ ๋ณผ์ ์์ต๋๋ค.
- Project Gradle (kts)
allprojects {
repositories {
maven { url = URI("https://jitpack.io") }
}
}
- App Module Gradle
dependencies {
// UI
implementation("com.github.sieunju.httptracking:ui:$latestVersion")
// Interceptor Java Module
implementation("com.github.sieunju.httptracking:interceptor:$latestVersion")
}
- ํน์๋ ๋จธํฐ๋ฆฌ์ผ์ ์ฌ์ฉํ์๊ฑฐ๋ ํ๋ก์ ํธ์ ์ฌ์ฉ์ค์ธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ์ถฉ๋์ด ์ผ์ด๋๋ ๊ฒฝ์ฐ์๋ ์๋์ ๊ฐ์ด ์ฌ์ฉํด์ฃผ์๋ฉด ๋ฉ๋๋ค. ๐โโ๏ธ
- A.K.A exclude
implementation("com.github.sieunju.httptracking:ui:${lateversion}") {
exclude("com.google.android.material")
exclude("androidx.appcompat:appcompat")
exclude("androidx.constraintlayout")
}
Builder ํจํด์ผ๋ก Application Class ์์ ๊ฐ๋จํ ๋น๋ ํ์ ์ ์ค์ ํฉ๋๋ค.
Application.kt
HttpTracking.Builder()
.setBuildType(BuildConfig.DEBUG)
.setLogMaxSize(3000)
.build(this)
OkHttpClient ์์ โaddInterceptorโ ๋ฅผ ํตํด TrackingHttpInterceptor ๋ฅผ ์ถ๊ฐํฉ๋๋ค.
ํด๋น ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ๋๋๋ก์ด๋ฉด ๋๋ฒ๊ทธ๋ชจ๋์๋ง ์ฒ๋ฆฌํ๋๋ก ์งํฅํฉ๋๋ค.
OkHttpClient.Builder().apply{
if(Debug) {
addInterceptor(TrackingHttpInterceptor)
}
}
UI Example |
---|
setWifiShare(true)
HttpTracking.Builder()
.setBuildType(BuildConfig.DEBUG)
.setWifiShare(true)
.setLogMaxSize(3000)
.build(this)
Step 1 | Step 2 | Step 3 |
---|---|---|
์์ ํ๋ฉด์ฒ๋ผ ์ํ๋ ๋ก๊ทธ๋ฅผ ์ ํํ์๊ณ ๊ณต์ ํ๊ธฐ ๋ฒํผ์ ์ ํํ์๋ฉด http://{ip}:{port}/tracking ์ฃผ์๊ฐ ๋ ธ์ถ๋๋๋ฐ ํด๋น ์ฃผ์๋ฅผ PC์ ์ ๋ ฅํ์๋ฉด ์ ํํ ๋ก๊ทธ๋ฅผ ๋ณผ์ ์์ต๋๋ค. ๐คฉ