Inspect HTTP(S), WebSocket, and Logger events from your iOS, iPadOS, and macOS apps in real time β through an embedded web UI running directly on your device.
-
π¦ HTTP Interceptor
Capture allURLSessionrequests and responses using a customURLProtocol. -
π WebSocket Logging
Wraps nativeURLSessionWebSocketTaskto record sent and received WebSocket messages. -
π Logger Bridge
Captureprint()and custom logs (e.g.,LogTapLogger) and stream them to the web UI. -
π Embedded web server
Lightweight SwiftNIO server runs inside your app.
Access the dashboard from your desktop browser via LAN (e.g.http://192.168.x.x:8790/). -
π Web UI
Live logs with filtering (method, status, log level), full request/response details, cURL export, multiple themes (Android Studio, Xcode, VSCode, Grafana). -
π‘ Safe for debug
Designed for DEBUG builds. Easily disable in release builds.
| Network View | Logger View | Detail Drawer | Sample app |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
- Go to File > Add Packagesβ¦
- Enter the repo URL:
https://github.com/Husseinhj/LogTapFramework.git - Select the LogTapFramework library and add it to your target.
Add to your dependencies:
dependencies: [
.package(url: "https://github.com/Husseinhj/LogTapFramework.git", from: "0.13.1")
]A fully functional SwiftUI sample project is bundled so you can try LogTap immediately.
- Clone the repository.
- Open
LogTapWorkspace.xcworkspace(workspace ensures the local package is resolved once). - Select the scheme:
LogTapSample. - Run on a simulator or (preferably) a real device to access from another machine on the LAN.
- Automatic startup of the embedded LogTap server (default sample port: 8795).
- Intercepted HTTP traffic (GET/POST/PUT/DELETE plus error/status edge cases).
- WebSocket echo connection & messages.
- Logger usage for all levels (
logV/logD/logI/logW/logE). - UI buttons that generate diverse traffic instantly.
On launch you'll see console output like:
[DEBUG] LogTap server ready at http://192.168.x.x:8795/
Open that URL in a desktop browser on the same network. Multiple LAN/IP variants may be printed; any reachable one works.
Inside LogTapSample.swift:
var cfg = LogTap.Config()
cfg.port = 8795 // change if port clashes
cfg.capacity = 5000 // ring buffer size
cfg.enableOnRelease = false
LogTap.shared.start(cfg)Change values, re-run, and refresh the web UI.
See the helper in the sample:
let cfg = URLSessionConfiguration.default
cfg.protocolClasses = [LogTapURLProtocol.self] + (cfg.protocolClasses ?? [])
let session = URLSession(configuration: cfg)Reuse that pattern in your app to log all requests automatically.
Simulators sometimes use loopback/isolated networking; running on a physical device gives the most reliable LAN access for the dashboard.
- If the configured port is taken, the server scans the next 9 ports and binds the first free one.
LogTap.shared.urls()always reports the port actually in use. - iOS reclaims the listening socket of an app that sits suspended for a while. LogTap re-binds automatically, and re-checks the listener every time the app returns to the foreground, so the dashboard comes back without relaunching the app.
- A re-bind first retries the same port so an open dashboard tab reconnects by itself. If that port has meanwhile been taken by something else, the server moves to another port in the range; the open tab cannot follow, so reopen the URL from
urls().
Usually in your AppDelegate or @main SwiftUI App:
import LogTapFramework
@main
struct MyApp: App {
init() {
#if DEBUG
// Start LogTap server on port 8790
var cfg = LogTap.Config()
cfg.port = 8790
cfg.capacity = 5000
cfg.enableOnRelease = false
LogTap.shared.start(cfg)
// Configure LogTapLogger and only use logD, logI, logW, logE in your app
LogTapLogger.shared.debugMode = true
LogTapLogger.shared.allowReleaseLogging = false
LogTapLogger.shared.minLevel = .verbose
// Optional: Logger bridge to capture print()
let sink = LogTapSinkAdapter()
LogTapPrintBridge.shared.start(sink: sink)
#else
LogTapLogger.shared.debugMode = false
LogTapLogger.shared.allowReleaseLogging = false
LogTapLogger.shared.minLevel = .warn
#endif
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}When your app runs, LogTap will print available server URLs to the Xcode console, e.g.:
[DEBUG] LogTap server ready at http://192.168.178.66:8790/
Open that address in your desktop browser to view logs.
logD("Debug example")
logI("Info example")
logW("Warn example")
logE("Error example")let config = URLSessionConfiguration.default
config.protocolClasses = [LogTapURLProtocol.self] + (config.protocolClasses ?? [])
let session = URLSession(configuration: config)
let task = session.dataTask(with: URL(string: "https://fakestoreapi.com/products")!) { data, response, error in
// Response will be logged automatically
}
task.resume()let url = URL(string: "wss://echo.websocket.org")!
let ws = LogTapWebSocketTask(url: url)
ws.send(.string("{\"hello\":\"world\"}"))- Filter logs by kind (HTTP / WebSocket / Logger)
- Inspect full headers, request & response bodies
- Export requests as cURL
- Switch themes: Android Studio, Xcode, VSCode, Grafana
- Works on mobile, tablet, and desktop browsers
- The server binds to your deviceβs LAN IP.
- Anyone on the same Wi-Fi can access it if they know the URL.
- Only enable in trusted networks and DEBUG builds.
- For production: disable or restrict via configuration.
Contributions, issues, and pull requests are welcome!
Please open an issue first to discuss major changes.
MIT License β see LICENSE for details.
- LogTap (Android) β the Android/Kotlin version of this library.



