Fix/excessive logging (#848)

* Remove log of mangas to update

This logged the full manga data objects in the list with information that is not needed (e.g. description of a manga).
Once a manga gets updated via the updater, it gets logged, which should be enough

* Include manga id in updater log

* Use "toString" to log mangas

* Change "HttpLoggingInterceptor" level to "BASIC"

Was unintentionally merged with d658e07583
This commit is contained in:
schroda
2024-01-24 23:49:16 +01:00
committed by GitHub
parent 562b940d91
commit fc64f47589
3 changed files with 8 additions and 6 deletions

View File

@@ -97,7 +97,7 @@ class NetworkHelper(context: Context) {
} }
}, },
).apply { ).apply {
level = HttpLoggingInterceptor.Level.HEADERS level = HttpLoggingInterceptor.Level.BASIC
} }
builder.addNetworkInterceptor(httpLoggingInterceptor) builder.addNetworkInterceptor(httpLoggingInterceptor)
// } // }

View File

@@ -195,14 +195,14 @@ class Updater : IUpdater {
tracker[job.manga.id] = tracker[job.manga.id] =
try { try {
logger.info { "Updating \"${job.manga.title}\" (source: ${job.manga.sourceId})" } logger.info { "Updating ${job.manga}" }
if (serverConfig.updateMangas.value) { if (serverConfig.updateMangas.value) {
Manga.getManga(job.manga.id, true) Manga.getManga(job.manga.id, true)
} }
Chapter.getChapterList(job.manga.id, true) Chapter.getChapterList(job.manga.id, true)
job.copy(status = JobStatus.COMPLETE) job.copy(status = JobStatus.COMPLETE)
} catch (e: Exception) { } catch (e: Exception) {
logger.error(e) { "Error while updating ${job.manga.title}" } logger.error(e) { "Error while updating ${job.manga}" }
if (e is CancellationException) throw e if (e is CancellationException) throw e
job.copy(status = JobStatus.FAILED) job.copy(status = JobStatus.FAILED)
} }
@@ -277,8 +277,6 @@ class Updater : IUpdater {
// In case no manga gets updated and no update job was running before, the client would never receive an info about its update request // In case no manga gets updated and no update job was running before, the client would never receive an info about its update request
updateStatus(emptyList(), mangasToUpdate.isNotEmpty(), updateStatusCategories, skippedMangas) updateStatus(emptyList(), mangasToUpdate.isNotEmpty(), updateStatusCategories, skippedMangas)
logger.debug { "mangasToUpdate $mangasToUpdate" }
if (mangasToUpdate.isEmpty()) { if (mangasToUpdate.isEmpty()) {
return return
} }

View File

@@ -43,7 +43,11 @@ data class MangaDataClass(
val age: Long? = if (lastFetchedAt == null) 0 else Instant.now().epochSecond.minus(lastFetchedAt), val age: Long? = if (lastFetchedAt == null) 0 else Instant.now().epochSecond.minus(lastFetchedAt),
val chaptersAge: Long? = if (chaptersLastFetchedAt == null) null else Instant.now().epochSecond.minus(chaptersLastFetchedAt), val chaptersAge: Long? = if (chaptersLastFetchedAt == null) null else Instant.now().epochSecond.minus(chaptersLastFetchedAt),
val trackers: List<MangaTrackerDataClass>? = null, val trackers: List<MangaTrackerDataClass>? = null,
) ) {
override fun toString(): String {
return "\"$title\" (id= $id) (sourceId= $sourceId)"
}
}
data class PagedMangaListDataClass( data class PagedMangaListDataClass(
val mangaList: List<MangaDataClass>, val mangaList: List<MangaDataClass>,