Skip to content

Commit 09630c4

Browse files
author
Hussein Habibi Juybari
committed
Update LogTap dependency versions in README.md to v0.5.0 and add auto-port increment feature documentation
1 parent 2604698 commit 09630c4

1 file changed

Lines changed: 56 additions & 6 deletions

File tree

README.md

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
Add the dependency in your `build.gradle`:
4646

4747
```gradle
48-
debugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.2.0'
49-
releaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0.2.0'
48+
debugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.5.0'
49+
releaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0..0'
5050
```
5151

5252
> 💡 Always use the latest version from the [GitHub Releases](https://github.com/Husseinhj/LogTap/releases).
@@ -93,6 +93,56 @@ http://<device-ip>:8790/
9393
>
9494
> (If you don't see the IP, ensure your app has `ACCESS_NETWORK_STATE` or LogTap will fall back to best-effort interface detection.)
9595
96+
### Multiple apps at once (auto‑port increment)
97+
98+
If you run LogTap from **multiple apps on the same device** at the same time, LogTap will automatically try the next port when the base port is busy. By default it starts at **8790**; if that’s taken, it tries **8791**, **8792**, and so on until it finds a free port (a small, bounded range).
99+
100+
You’ll see the chosen address printed to **Logcat** when the server is ready, for example:
101+
102+
```
103+
… I LogTap server ready at http://192.168.178.66:8790/
104+
… I LogTap server ready at http://192.168.178.66:8791/
105+
```
106+
107+
> Tip: You can also **pick different base ports** per app to avoid clashes entirely.
108+
109+
#### Example
110+
111+
**App A** – use default base port (8790):
112+
```kotlin
113+
class AppA : Application() {
114+
override fun onCreate() {
115+
super.onCreate()
116+
LogTap.start(this) // tries 8790, then 8791, ... if needed
117+
}
118+
}
119+
```
120+
121+
**App B** – set an explicit base port (e.g., 8795):
122+
```kotlin
123+
class AppB : Application() {
124+
override fun onCreate() {
125+
super.onCreate()
126+
LogTap.start(
127+
this,
128+
LogTap.Config(
129+
port = 8795, // base port; LogTap will auto‑increment if 8795 is in use
130+
capacity = 5000
131+
)
132+
)
133+
}
134+
}
135+
```
136+
137+
Then open in your browser from the same network:
138+
139+
```
140+
http://<device-ip>:8790/ // App A
141+
http://<device-ip>:8791/ // App A (if 8790 was busy)
142+
http://<device-ip>:8795/ // App B
143+
http://<device-ip>:8796/ // App B (if 8795 was busy)
144+
```
145+
96146
### 5. Advanced: Automatic Logcat collection
97147

98148
For more settings and to automatically collect logs from Android's logger, you can use `LogTapLogcatBridge` together with a `LogTapSinkAdapter`:
@@ -129,8 +179,8 @@ You can restrict LogTap only to a specific build flavor (e.g., `dev`) by declari
129179

130180
```gradle
131181
dependencies {
132-
devDebugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.2.0'
133-
devReleaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0.2.0'
182+
devDebugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.5.0'
183+
devReleaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0.5.0'
134184
}
135185
```
136186

@@ -158,9 +208,9 @@ android {
158208
- If you want the library only in the `dev` flavor, keep:
159209

160210
```gradle
161-
devDebugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.2.0'
211+
devDebugImplementation 'com.github.Husseinhj.LogTap:logtap:v0.5.0'
162212
// (Optional) If you also build devRelease, use the noop artifact there:
163-
devReleaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0.2.0'
213+
devReleaseImplementation 'com.github.Husseinhj.LogTap:logtap-noop:v0.5.0'
164214
```
165215

166216
- If you prefer **no dependency at all** on release variants (including prod/staging), **do not** add a release dependency. We’ll provide **stubs** instead.

0 commit comments

Comments
 (0)