Add more verbose logging

This commit is contained in:
Kirill Kamakin
2021-11-07 21:02:28 +03:00
parent 9efd90037c
commit 12e7096c17
2 changed files with 4 additions and 0 deletions

View File

@@ -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

View File

@@ -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" }