diff --git a/mobile/src/base/java/be/mygod/vpnhotspot/Timber.kt b/mobile/src/base/java/be/mygod/vpnhotspot/Timber.kt index 7f72fdc3..bb6775ee 100644 --- a/mobile/src/base/java/be/mygod/vpnhotspot/Timber.kt +++ b/mobile/src/base/java/be/mygod/vpnhotspot/Timber.kt @@ -22,3 +22,5 @@ fun initTimber() { fun debugLog(tag: String?, message: String?) { if (BuildConfig.DEBUG) Timber.tag(tag).d(message) else Crashlytics.log("$tag: $message") } + +fun timberSetString(key: String, value: String?) = Crashlytics.setString(key, value) diff --git a/mobile/src/fdroid/java/be/mygod/vpnhotspot/Timber.kt b/mobile/src/fdroid/java/be/mygod/vpnhotspot/Timber.kt index 7cf9d943..58aed317 100644 --- a/mobile/src/fdroid/java/be/mygod/vpnhotspot/Timber.kt +++ b/mobile/src/fdroid/java/be/mygod/vpnhotspot/Timber.kt @@ -5,3 +5,5 @@ import timber.log.Timber fun initTimber() = Timber.plant(Timber.DebugTree()) fun debugLog(tag: String?, message: String?) = Timber.tag(tag).d(message) + +fun timberSetString(key: String, value: String?) = Timber.tag(key).d(value) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/LocalOnlyHotspotService.kt b/mobile/src/main/java/be/mygod/vpnhotspot/LocalOnlyHotspotService.kt index fc447a5a..8fae6627 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/LocalOnlyHotspotService.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/LocalOnlyHotspotService.kt @@ -12,7 +12,6 @@ import be.mygod.vpnhotspot.net.wifi.WifiDoubleLock import be.mygod.vpnhotspot.util.StickyEvent1 import be.mygod.vpnhotspot.util.broadcastReceiver import be.mygod.vpnhotspot.widget.SmartSnackbar -import timber.log.Timber @RequiresApi(26) class LocalOnlyHotspotService : IpNeighbourMonitoringService() { @@ -35,7 +34,6 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() { fun stop() = reservation?.close() } - private class StartFailure(message: String) : RuntimeException(message) private val binder = Binder() private var reservation: WifiManager.LocalOnlyHotspotReservation? = null @@ -105,9 +103,6 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() { else -> getString(R.string.failure_reason_unknown, reason) }) SmartSnackbar.make(message).show() - if (reason != WifiManager.LocalOnlyHotspotCallback.ERROR_INCOMPATIBLE_MODE) { - Timber.i(StartFailure(message)) - } startFailure() } }, app.handler) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt index 398d3cd5..300843cc 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt @@ -3,8 +3,8 @@ package be.mygod.vpnhotspot.net.wifi import android.net.wifi.p2p.WifiP2pGroup import android.os.Build import be.mygod.vpnhotspot.App.Companion.app +import be.mygod.vpnhotspot.timberSetString import be.mygod.vpnhotspot.util.RootSession -import timber.log.Timber import java.io.File /** @@ -14,6 +14,7 @@ import java.io.File */ class P2pSupplicantConfiguration(private val group: WifiP2pGroup, ownerAddress: String?) { companion object { + private const val TAG = "P2pSupplicantConfiguration" private val networkParser = "^(bssid=(([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})|psk=(ext:|\"(.*)\"|[0-9a-fA-F]{64}\$))".toRegex() private val whitespaceMatcher = "\\s+".toRegex() @@ -78,8 +79,9 @@ class P2pSupplicantConfiguration(private val group: WifiP2pGroup, ownerAddress: } Pair(result, target!!) } catch (e: RuntimeException) { - Timber.w("Failed to parse p2p_supplicant.conf, ownerAddress: $ownerAddress, P2P group: $group") - Timber.w(parser.lines.joinToString("\n")) + timberSetString(TAG, parser.lines.joinToString("\n")) + timberSetString("$TAG.ownerAddress", ownerAddress) + timberSetString("$TAG.p2pGroup", group.toString()) throw e } }