mirror of
https://github.com/bitfireAT/davx5-ose.git
synced 2025-12-23 23:17:50 -05:00
Lower default minimum log level from INFO to FINE (#1827)
* Increase logging level * Adjust log levels for visibility in non-verbose logs - Change log level from FINER to FINE in StreamingFileDescriptor - Update log level from FINER to FINE in AccountSettingsMigration8 - Add note about log levels in LogManager documentation * Fix KDoc typo * Update comment
This commit is contained in:
@@ -39,6 +39,10 @@ import javax.inject.Singleton
|
||||
*
|
||||
* When using the global logger, the class name of the logging calls will still be logged, so there's
|
||||
* no need to always get a separate logger for each class (only if the class wants to customize it).
|
||||
*
|
||||
* Note about choosing log levels: records with [Level.FINE] or higher will always be printed to adb logs
|
||||
* (regardless of whether verbose logging is active). Records with a lower level will only be
|
||||
* printed to adb logs when verbose logging is active.
|
||||
*/
|
||||
@Singleton
|
||||
class LogManager @Inject constructor(
|
||||
@@ -79,7 +83,10 @@ class LogManager @Inject constructor(
|
||||
|
||||
// root logger: set default log level and always log to logcat
|
||||
val rootLogger = Logger.getLogger("")
|
||||
rootLogger.level = if (logVerbose) Level.ALL else Level.INFO
|
||||
rootLogger.level = if (logVerbose)
|
||||
Level.ALL // include everything (including HTTP interceptor logs) in verbose logs
|
||||
else
|
||||
Level.FINE // include detailed information like content provider operations in non-verbose logs
|
||||
rootLogger.addHandler(LogcatHandler(BuildConfig.APPLICATION_ID))
|
||||
|
||||
// log to file, if requested
|
||||
|
||||
@@ -18,7 +18,6 @@ import dagger.hilt.components.SingletonComponent
|
||||
import dagger.multibindings.IntKey
|
||||
import dagger.multibindings.IntoMap
|
||||
import org.dmfs.tasks.contract.TaskContract
|
||||
import org.dmfs.tasks.contract.TaskContract.CommonSyncColumns
|
||||
import java.util.logging.Level
|
||||
import java.util.logging.Logger
|
||||
import javax.inject.Inject
|
||||
@@ -50,7 +49,7 @@ class AccountSettingsMigration8 @Inject constructor(
|
||||
TaskContract.Tasks.SYNC1 to null,
|
||||
TaskContract.Tasks.SYNC2 to null
|
||||
)
|
||||
logger.log(Level.FINER, "Updating task $id", values)
|
||||
logger.log(Level.FINE, "Updating task $id", values)
|
||||
provider.client.update(
|
||||
ContentUris.withAppendedId(provider.tasksUri(), id).asSyncAdapter(account),
|
||||
values, null, null)
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.accounts.Account
|
||||
import android.content.ContentResolver
|
||||
import android.content.Context
|
||||
import android.content.SyncRequest
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.annotation.WorkerThread
|
||||
import at.bitfire.davdroid.resource.LocalAddressBookStore
|
||||
|
||||
@@ -97,7 +97,7 @@ class StreamingFileDescriptor @AssistedInject constructor(
|
||||
body.byteStream().use { source ->
|
||||
transferred += source.copyTo(destination)
|
||||
}
|
||||
logger.finer("Downloaded $transferred byte(s) from $url")
|
||||
logger.fine("Downloaded $transferred byte(s) from $url")
|
||||
}
|
||||
|
||||
} else
|
||||
@@ -118,7 +118,7 @@ class StreamingFileDescriptor @AssistedInject constructor(
|
||||
override fun writeTo(sink: BufferedSink) {
|
||||
ParcelFileDescriptor.AutoCloseInputStream(readFd).use { input ->
|
||||
transferred += input.copyTo(sink.outputStream())
|
||||
logger.finer("Uploaded $transferred byte(s) to $url")
|
||||
logger.fine("Uploaded $transferred byte(s) to $url")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user