Production Usage
It is not recommended to activate LogDog in production for each user of your application. Instead we provide several ways to activate it in production in a simple way.
- Trigger via a hidden setting/button
- Trigger via Deeplink
Trigger via a hidden setting
With this simple approach LogDog can be activated/deactivated whenever it's needed. If your application has already a hidden Debug Window or Menu we recommend placing this button in there. To deactivate LogDog just call start() again and set every option of the config to false.
struct ContentView: View {
@State private var tapCount = 0
var body: some View {
VStack {
Button("Version 1.0.0") {
tapCount += 1
if tapCount >= 3 {
tapCount = 0
let config = LogDogConfig(apiKey: "YOUR_API_KEY", logs: true, prints: true, network: true, events: true)
LogDog.initialize()
LogDog.start(config:config)
LogDog.i("Hello from LogDog!")
}
}
}
}
}
Configure Deeplinks (Universal Links)
One easy way to achieve an on demand activation are universal links (also known as deeplinks).
This scenario can be useful if a user of your application needs remote support. Then LogDog can be enabled with a simple click on a link shared via email.
You can enable Deeplinks by opening your target in XCode and then go to "Signing & Capabilities"
.
Then scroll down to "Associated Domains"
and add the following entry:
applinks:open.logdog.app
To handle a clicked universal link the following lines are required:
With SwiftUI:
var body: some Scene {
WindowGroup {
ContentView()
.onOpenURL { url in
if url.path == "/start-log-dog" {
LogDog.initialize()
let config = LogDogConfig(apiKey: "YOUR_API_KEY", logs: true, network: true, events: true)
LogDog.start(config: config)
}
if url.path == "/stop-log-dog" {
let config = LogDogConfig(apiKey: "YOUR_API_KEY", logs: false, network: false, events: false)
LogDog.start(config: config)
}
}
}
}
With UIKit:
func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL {
if url.path == "/start-log-dog" {
LogDog.initialize()
let config = LogDogConfig(apiKey: "YOUR_API_KEY", logs: true, network: true, events: true)
LogDog.start(config: config)
}
if url.path == "/stop-log-dog" {
LogDog.initialize()
let config = LogDogConfig(apiKey: "YOUR_API_KEY", logs: false, network: false, events: false)
LogDog.start(config: config)
}
}
return true
}
You can then share the link: open.logdog.app/start-log-dog with a user seeking support. Feel free to change the path or domain to something custom. Please note that a custom domain requires additional steps to get the universal link working.
To find out more on universal links please check here
Tip: You can also pass a custom device name like open.logdog.app/start-log-dog?device-name=User123 with the universal link. This will then later enable you to assign a memorable name for the device in LogDog.
LogDog.setCustomDeviceName(name: "User123")
Support
If you have questions send us an email via support@logdog.app. We are happy to help!