From 6ceb5dab2007abb7482b4163bf4b6ea54faa9475 Mon Sep 17 00:00:00 2001 From: Mygod Date: Tue, 15 Jan 2019 15:44:36 +0800 Subject: [PATCH] Make loglevel configurable --- .../github/shadowsocks/plugin/v2ray/ConfigFragment.kt | 3 +++ app/src/main/res/values/arrays.xml | 7 +++++++ app/src/main/res/xml/config.xml | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt b/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt index 2edd2c3..53ae617 100644 --- a/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt +++ b/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt @@ -41,6 +41,7 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange private val host by lazy { findPreference("host") } private val path by lazy { findPreference("path") } private val certRaw by lazy { findPreference("certRaw") } + private val loglevel by lazy { findPreference("loglevel") } private fun readMode(value: String = mode.value) = when (value) { "websocket-http" -> Pair(null, null) @@ -59,6 +60,7 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange putWithDefault("host", host.text, "cloudfront.com") putWithDefault("path", path.text, "/") putWithDefault("certRaw", certRaw.text.replace("\n", ""), "") + putWithDefault("loglevel", loglevel.value, "warning") } fun onInitializePluginOptions(options: PluginOptions) { @@ -70,6 +72,7 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange host.text = options["host"] ?: "cloudfront.com" path.text = options["path"] ?: "/" certRaw.text = options["certRaw"] + loglevel.value = options["loglevel"] ?: "warning" } override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 242edd2..1c20449 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -5,4 +5,11 @@ websocket-tls quic-tls + + debug + info + warning + error + none + diff --git a/app/src/main/res/xml/config.xml b/app/src/main/res/xml/config.xml index a1e0e84..35f4a2d 100644 --- a/app/src/main/res/xml/config.xml +++ b/app/src/main/res/xml/config.xml @@ -22,4 +22,14 @@ app:persistent="false" app:title="Certificate for TLS verification" app:useSimpleSummaryProvider="true"/> + + +