diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt index 63bf4a5724..888c6ff71c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt @@ -1,8 +1,6 @@ package info.nightscout.androidaps.plugins.general.maintenance -import ch.qos.logback.classic.LoggerContext import info.nightscout.androidaps.annotations.OpenForTesting -import org.slf4j.LoggerFactory import javax.inject.Inject import javax.inject.Singleton @@ -11,7 +9,9 @@ import javax.inject.Singleton */ @OpenForTesting @Singleton -class LoggerUtils @Inject constructor() { +class LoggerUtils @Inject constructor( + val prefFileListProvider: PrefFileListProvider +) { var suffix = ".log.zip" @@ -21,9 +21,15 @@ class LoggerUtils @Inject constructor() { * * @return */ +/* + This is failing after slf4j update to 2.0.0 + It would be better to find a way to read the value from xml + So far replaced by static value val logDirectory: String get() { val lc = LoggerFactory.getILoggerFactory() as LoggerContext return lc.getProperty("EXT_FILES_DIR") } +*/ + val logDirectory get() = prefFileListProvider.logsPath } \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt index 0154bca89b..93d3c9c8a1 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.general.maintenance +import android.content.Context import android.os.Environment import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.core.R @@ -26,7 +27,8 @@ class PrefFileListProvider @Inject constructor( private val config: Config, private val encryptedPrefsFormat: EncryptedPrefsFormat, private val storage: Storage, - private val versionCheckerUtils: VersionCheckerUtils + private val versionCheckerUtils: VersionCheckerUtils, + context: Context ) { @Suppress("DEPRECATION") private val path = File(Environment.getExternalStorageDirectory().toString()) @@ -34,6 +36,7 @@ class PrefFileListProvider @Inject constructor( private val exportsPath = File(path, "AAPS" + File.separator + "exports") private val tempPath = File(path, "AAPS" + File.separator + "temp") private val extraPath = File(path, "AAPS" + File.separator + "extra") + val logsPath: String = File(path, "AAPS" + File.separator + "logs" + File.separator + context.packageName).absolutePath companion object { @@ -85,7 +88,7 @@ class PrefFileListProvider @Inject constructor( return checkMetadata(encryptedPrefsFormat.loadMetadata(contents)) } - fun legacyFile(): File { + @Suppress("unused") fun legacyFile(): File { return File(path, rh.gs(R.string.app_name) + "Preferences") }