Commit 9a1ea102 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Added a preference for advanced logging, which logs messages from the vpn library with a FINE level

parent 5b4fe1fe
...@@ -782,13 +782,14 @@ class DnsVpnService : VpnService(), Runnable { ...@@ -782,13 +782,14 @@ class DnsVpnService : VpnService(), Runnable {
log("DnsProxy created, creating VPN proxy") log("DnsProxy created, creating VPN proxy")
vpnProxy = VPNTunnelProxy(dnsProxy!!, vpnService = this, coroutineScope = CoroutineScope( vpnProxy = VPNTunnelProxy(dnsProxy!!, vpnService = this, coroutineScope = CoroutineScope(
newFixedThreadPoolContext(2, "proxy-pool")), logger = object:com.frostnerd.vpntunnelproxy.Logger() { newFixedThreadPoolContext(2, "proxy-pool")), logger = object:com.frostnerd.vpntunnelproxy.Logger() {
val advancedLogging = getPreferences().advancedLogging
override fun logException(ex: Exception, terminal: Boolean, level: Level) { override fun logException(ex: Exception, terminal: Boolean, level: Level) {
if(terminal) log(ex) if(terminal) log(ex)
else log(Logger.stacktraceToString(ex), "VPN-LIBRARY, $level") else log(Logger.stacktraceToString(ex), "VPN-LIBRARY, $level")
} }
override fun logMessage(message: String, level: Level) { override fun logMessage(message: String, level: Level) {
if(level >= Level.INFO || (BuildConfig.DEBUG && level >= Level.FINE)) { if(level >= Level.INFO || ((BuildConfig.DEBUG || advancedLogging) && level >= Level.FINE)) {
log(message, "VPN-LIBRARY, $level") log(message, "VPN-LIBRARY, $level")
} }
} }
......
...@@ -193,6 +193,10 @@ class AppSettingsSharedPreferences(context: Context) : AppSettings, SimpleTypedP ...@@ -193,6 +193,10 @@ class AppSettingsSharedPreferences(context: Context) : AppSettings, SimpleTypedP
"logging_enabled", "logging_enabled",
BuildConfig.VERSION_NAME.contains("alpha", true) || BuildConfig.VERSION_NAME.contains("beta", true) BuildConfig.VERSION_NAME.contains("alpha", true) || BuildConfig.VERSION_NAME.contains("beta", true)
) )
var advancedLogging:Boolean by booleanPref(
"advanced_logging",
false
)
override var crashReportingEnabled: Boolean by booleanPref("enable_sentry", false) override var crashReportingEnabled: Boolean by booleanPref("enable_sentry", false)
override var enableIpv6: Boolean by booleanPref("ipv6_enabled", true) override var enableIpv6: Boolean by booleanPref("ipv6_enabled", true)
......
...@@ -71,6 +71,9 @@ ...@@ -71,6 +71,9 @@
<string name="title_enable_logging">Enable logging</string> <string name="title_enable_logging">Enable logging</string>
<string name="summary_enable_logging">Enables logging of debug information (contains statistic data). These logs aren\'t send automatically.</string> <string name="summary_enable_logging">Enables logging of debug information (contains statistic data). These logs aren\'t send automatically.</string>
<string name="title_advanced_logging">Advanced logging</string>
<string name="summary_advanced_logging">Adds more logging, which could help with more persistent problems.</string>
<string name="title_send_logs">Send logs</string> <string name="title_send_logs">Send logs</string>
<string name="summary_send_logs">Click here to send the logs to the developer.</string> <string name="summary_send_logs">Click here to send the logs to the developer.</string>
......
...@@ -131,6 +131,12 @@ ...@@ -131,6 +131,12 @@
android:summary="@string/summary_enable_logging" android:summary="@string/summary_enable_logging"
android:key="logging_enabled"/> android:key="logging_enabled"/>
<CheckBoxPreference
android:title="@string/title_advanced_logging"
android:summary="@string/summary_advanced_logging"
android:dependency="logging_enabled"
android:key="advanced_logging"/>
<Preference <Preference
android:key="send_logs" android:key="send_logs"
android:title="@string/title_send_logs" android:title="@string/title_send_logs"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment