Add more verbose logging
This commit is contained in:
@@ -8,6 +8,7 @@ import androidx.paging.RemoteMediator
|
|||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeEntity
|
import gq.kirmanak.mealie.data.recipes.db.RecipeEntity
|
||||||
import gq.kirmanak.mealie.data.recipes.db.RecipeStorage
|
import gq.kirmanak.mealie.data.recipes.db.RecipeStorage
|
||||||
import gq.kirmanak.mealie.data.recipes.network.RecipeDataSource
|
import gq.kirmanak.mealie.data.recipes.network.RecipeDataSource
|
||||||
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ExperimentalPagingApi
|
@ExperimentalPagingApi
|
||||||
@@ -35,6 +36,7 @@ class RecipesRemoteMediator @Inject constructor(
|
|||||||
val recipes = try {
|
val recipes = try {
|
||||||
network.requestRecipes(start = start, end = end)
|
network.requestRecipes(start = start, end = end)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
Timber.e("Can't load recipes", e)
|
||||||
return MediatorResult.Error(e)
|
return MediatorResult.Error(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +46,7 @@ class RecipesRemoteMediator @Inject constructor(
|
|||||||
PREPEND, APPEND -> storage.saveRecipes(recipes)
|
PREPEND, APPEND -> storage.saveRecipes(recipes)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
Timber.e("Can't save recipes", e)
|
||||||
return MediatorResult.Error(e)
|
return MediatorResult.Error(e)
|
||||||
}
|
}
|
||||||
val expectedCount = end - start
|
val expectedCount = end - start
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class RecipeDataSourceImpl @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun getRecipeService(): RecipeService {
|
private suspend fun getRecipeService(): RecipeService {
|
||||||
|
Timber.v("getRecipeService() called")
|
||||||
val cachedService: RecipeService? = _recipeService
|
val cachedService: RecipeService? = _recipeService
|
||||||
val service: RecipeService = if (cachedService == null) {
|
val service: RecipeService = if (cachedService == null) {
|
||||||
val baseUrl = checkNotNull(authRepo.getBaseUrl()) { "Base url is null" }
|
val baseUrl = checkNotNull(authRepo.getBaseUrl()) { "Base url is null" }
|
||||||
|
|||||||
Reference in New Issue
Block a user