Skip to content

Commit

Permalink
split disk and prefs logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Razeeman committed Oct 20, 2024
1 parent a02906a commit ea032c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package com.example.util.simpletimetracker.data_local.repo
object RepoConstants {
const val LOG_MESSAGE_PREFIX = "DB_ACCESS"
const val LOG_MESSAGE_PREFS_PREFIX = "PREFS"
const val LOG_MESSAGE_DISK_PREFIX = "DISK"
const val LOG_MESSAGE_CACHE = "CACHE"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.example.util.simpletimetracker.data_local.utils

import android.content.SharedPreferences
import com.example.util.simpletimetracker.data_local.repo.RepoConstants.LOG_MESSAGE_CACHE
import com.example.util.simpletimetracker.data_local.repo.RepoConstants.LOG_MESSAGE_DISK_PREFIX
import com.example.util.simpletimetracker.data_local.repo.RepoConstants.LOG_MESSAGE_PREFIX
import com.example.util.simpletimetracker.data_local.repo.RepoConstants.LOG_MESSAGE_PREFS_PREFIX
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -88,16 +89,24 @@ internal suspend inline fun <T> Mutex.withLockedCache(
* Inlined for message tag to be an actual class name at call site.
*/
@Suppress("NOTHING_TO_INLINE")
internal inline fun logDataAccess(logMessage: String) {
private inline fun logDataAccessInternal(logMessage: String) {
Timber.d("$LOG_MESSAGE_PREFIX $logMessage")
}

/**
* Inlined for message tag to be an actual class name at call site.
*/
@Suppress("NOTHING_TO_INLINE")
internal inline fun logDataAccess(logMessage: String) {
logDataAccessInternal("$LOG_MESSAGE_DISK_PREFIX $logMessage")
}

/**
* Inlined for message tag to be an actual class name at call site.
*/
@Suppress("NOTHING_TO_INLINE")
internal inline fun logPrefsDataAccess(logMessage: String) {
logDataAccess("$LOG_MESSAGE_PREFS_PREFIX $logMessage")
logDataAccessInternal("$LOG_MESSAGE_PREFS_PREFIX $logMessage")
}

/**
Expand Down

0 comments on commit ea032c4

Please sign in to comment.