Debug Window
The debug window is a useful tool to simplify your debugging experience. It helps with the following aspects:
- Access to your logs right on a mobile device
- Check the connectivity to the LogDog servers
- A kill switch to fully disable the LogDog SDK
- Toggling on/off sub-features of LogDog
- Delete Logs
- Delete Mock cache
The debug modal can be integrated into your application in different ways.
One recommended way it to place the apps version number in a settings menu and require for example 3-5 taps until it shows the debug window. This way users will not trigger it by accident.
Example SwiftUI
import SwiftUI
import LogDog
struct ContentView: View {
@State private var isShown = false
var body: some View {
VStack(spacing: 20) {
Text("Hello, world!")
Button("Show LogDog Sheet") {
isShown = true
}
}
.logDogSheet(isShown: isShown) // Conditionally show the LogDog debug sheet
}
}
Debug Shake
LogDog detects if you shake your device and then shows the debug window. This functionality is active by default if you add .logDogSheet() to your SwiftUI view.
If this default behaviour is not desired please use the following:
LogDog.setDebugShake(false)
Example UIKit
If you application does not use SwiftUI you can trigger the debug window via the following snippet:
import UIKit
import SwiftUI
import LogDog
class MyViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
if motion == .motionShake {
let rootView = LogDogControlSheet(isPresented: .constant(true))
let hostingController = UIHostingController(rootView: rootView)
hostingController.modalPresentationStyle = .formSheet
hostingController.modalTransitionStyle = .coverVertical
self.present(hostingController, animated: true)
}
}
}
The debug window can also be triggered via the LogDog dashoard.
Open the dashboard and click on any device. Then click on Open Debug Window
.