Reduce garbage logs
This commit is contained in:
@@ -22,3 +22,5 @@ fun initTimber() {
|
|||||||
fun debugLog(tag: String?, message: String?) {
|
fun debugLog(tag: String?, message: String?) {
|
||||||
if (BuildConfig.DEBUG) Timber.tag(tag).d(message) else Crashlytics.log("$tag: $message")
|
if (BuildConfig.DEBUG) Timber.tag(tag).d(message) else Crashlytics.log("$tag: $message")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun timberSetString(key: String, value: String?) = Crashlytics.setString(key, value)
|
||||||
|
|||||||
@@ -5,3 +5,5 @@ import timber.log.Timber
|
|||||||
fun initTimber() = Timber.plant(Timber.DebugTree())
|
fun initTimber() = Timber.plant(Timber.DebugTree())
|
||||||
|
|
||||||
fun debugLog(tag: String?, message: String?) = Timber.tag(tag).d(message)
|
fun debugLog(tag: String?, message: String?) = Timber.tag(tag).d(message)
|
||||||
|
|
||||||
|
fun timberSetString(key: String, value: String?) = Timber.tag(key).d(value)
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import be.mygod.vpnhotspot.net.wifi.WifiDoubleLock
|
|||||||
import be.mygod.vpnhotspot.util.StickyEvent1
|
import be.mygod.vpnhotspot.util.StickyEvent1
|
||||||
import be.mygod.vpnhotspot.util.broadcastReceiver
|
import be.mygod.vpnhotspot.util.broadcastReceiver
|
||||||
import be.mygod.vpnhotspot.widget.SmartSnackbar
|
import be.mygod.vpnhotspot.widget.SmartSnackbar
|
||||||
import timber.log.Timber
|
|
||||||
|
|
||||||
@RequiresApi(26)
|
@RequiresApi(26)
|
||||||
class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
|
class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
|
||||||
@@ -35,7 +34,6 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
|
|||||||
|
|
||||||
fun stop() = reservation?.close()
|
fun stop() = reservation?.close()
|
||||||
}
|
}
|
||||||
private class StartFailure(message: String) : RuntimeException(message)
|
|
||||||
|
|
||||||
private val binder = Binder()
|
private val binder = Binder()
|
||||||
private var reservation: WifiManager.LocalOnlyHotspotReservation? = null
|
private var reservation: WifiManager.LocalOnlyHotspotReservation? = null
|
||||||
@@ -105,9 +103,6 @@ class LocalOnlyHotspotService : IpNeighbourMonitoringService() {
|
|||||||
else -> getString(R.string.failure_reason_unknown, reason)
|
else -> getString(R.string.failure_reason_unknown, reason)
|
||||||
})
|
})
|
||||||
SmartSnackbar.make(message).show()
|
SmartSnackbar.make(message).show()
|
||||||
if (reason != WifiManager.LocalOnlyHotspotCallback.ERROR_INCOMPATIBLE_MODE) {
|
|
||||||
Timber.i(StartFailure(message))
|
|
||||||
}
|
|
||||||
startFailure()
|
startFailure()
|
||||||
}
|
}
|
||||||
}, app.handler)
|
}, app.handler)
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package be.mygod.vpnhotspot.net.wifi
|
|||||||
import android.net.wifi.p2p.WifiP2pGroup
|
import android.net.wifi.p2p.WifiP2pGroup
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import be.mygod.vpnhotspot.App.Companion.app
|
import be.mygod.vpnhotspot.App.Companion.app
|
||||||
|
import be.mygod.vpnhotspot.timberSetString
|
||||||
import be.mygod.vpnhotspot.util.RootSession
|
import be.mygod.vpnhotspot.util.RootSession
|
||||||
import timber.log.Timber
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,6 +14,7 @@ import java.io.File
|
|||||||
*/
|
*/
|
||||||
class P2pSupplicantConfiguration(private val group: WifiP2pGroup, ownerAddress: String?) {
|
class P2pSupplicantConfiguration(private val group: WifiP2pGroup, ownerAddress: String?) {
|
||||||
companion object {
|
companion object {
|
||||||
|
private const val TAG = "P2pSupplicantConfiguration"
|
||||||
private val networkParser =
|
private val networkParser =
|
||||||
"^(bssid=(([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})|psk=(ext:|\"(.*)\"|[0-9a-fA-F]{64}\$))".toRegex()
|
"^(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()
|
private val whitespaceMatcher = "\\s+".toRegex()
|
||||||
@@ -78,8 +79,9 @@ class P2pSupplicantConfiguration(private val group: WifiP2pGroup, ownerAddress:
|
|||||||
}
|
}
|
||||||
Pair(result, target!!)
|
Pair(result, target!!)
|
||||||
} catch (e: RuntimeException) {
|
} catch (e: RuntimeException) {
|
||||||
Timber.w("Failed to parse p2p_supplicant.conf, ownerAddress: $ownerAddress, P2P group: $group")
|
timberSetString(TAG, parser.lines.joinToString("\n"))
|
||||||
Timber.w(parser.lines.joinToString("\n"))
|
timberSetString("$TAG.ownerAddress", ownerAddress)
|
||||||
|
timberSetString("$TAG.p2pGroup", group.toString())
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user