mirror of
https://github.com/etesync/android
synced 2024-12-23 15:18:14 +00:00
Add a setting to control log verbosity.
This commit is contained in:
parent
705df2a536
commit
d147728acd
@ -34,6 +34,7 @@ import java.util.logging.Level
|
||||
object Logger : SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
private const val LOG_TO_FILE = "log_to_file"
|
||||
private const val LOG_VERBOSE = "log_verbose"
|
||||
|
||||
val log = java.util.logging.Logger.getLogger("etesync")!!
|
||||
|
||||
@ -49,7 +50,7 @@ object Logger : SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
|
||||
if (key == LOG_TO_FILE) {
|
||||
if (key == LOG_TO_FILE || key == LOG_VERBOSE) {
|
||||
log.info("Logging settings changed; re-initializing logger")
|
||||
reinitialize()
|
||||
}
|
||||
@ -57,7 +58,7 @@ object Logger : SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
private fun reinitialize() {
|
||||
val logToFile = preferences.getBoolean(LOG_TO_FILE, false)
|
||||
val logVerbose = logToFile || Log.isLoggable(Logger.log.name, Log.DEBUG)
|
||||
val logVerbose = preferences.getBoolean(LOG_VERBOSE, false) || Log.isLoggable(Logger.log.name, Log.DEBUG)
|
||||
|
||||
log.info("Verbose logging: $logVerbose; to file: $logToFile")
|
||||
|
||||
|
@ -106,6 +106,8 @@
|
||||
<string name="app_settings_log_to_external_storage">Log to external file</string>
|
||||
<string name="app_settings_log_to_external_storage_on">Logging to external storage. Disable to hide the notification.</string>
|
||||
<string name="app_settings_log_to_external_storage_off">External file logging is disabled</string>
|
||||
<string name="app_settings_log_verbose">Verbose logging</string>
|
||||
<string name="app_settings_log_verbose_summary">Verbose logs may contain private information</string>
|
||||
<string name="app_settings_show_debug_info">Show debug info</string>
|
||||
<string name="app_settings_show_debug_info_details">View/share software and configuration details</string>
|
||||
<string name="app_settings_force_language">Force Language</string>
|
||||
|
@ -67,6 +67,11 @@
|
||||
android:summaryOn="@string/app_settings_log_to_external_storage_on"
|
||||
android:summaryOff="@string/app_settings_log_to_external_storage_off"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:key="log_verbose"
|
||||
android:title="@string/app_settings_log_verbose"
|
||||
android:summary="@string/app_settings_log_verbose_summary"/>
|
||||
|
||||
<ListPreference
|
||||
android:key="select_language"
|
||||
android:title="@string/app_settings_force_language"/>
|
||||
|
Loading…
Reference in New Issue
Block a user