Skip to content

Commit

Permalink
Fix/excessive logging (#848)
Browse files Browse the repository at this point in the history
* 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 d658e07
  • Loading branch information
schroda authored Jan 24, 2024
1 parent 562b940 commit fc64f47
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class NetworkHelper(context: Context) {
}
},
).apply {
level = HttpLoggingInterceptor.Level.HEADERS
level = HttpLoggingInterceptor.Level.BASIC
}
builder.addNetworkInterceptor(httpLoggingInterceptor)
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ class Updater : IUpdater {

tracker[job.manga.id] =
try {
logger.info { "Updating \"${job.manga.title}\" (source: ${job.manga.sourceId})" }
logger.info { "Updating ${job.manga}" }
if (serverConfig.updateMangas.value) {
Manga.getManga(job.manga.id, true)
}
Chapter.getChapterList(job.manga.id, true)
job.copy(status = JobStatus.COMPLETE)
} 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
job.copy(status = JobStatus.FAILED)
}
Expand Down Expand Up @@ -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
updateStatus(emptyList(), mangasToUpdate.isNotEmpty(), updateStatusCategories, skippedMangas)

logger.debug { "mangasToUpdate $mangasToUpdate" }

if (mangasToUpdate.isEmpty()) {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ data class MangaDataClass(
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 trackers: List<MangaTrackerDataClass>? = null,
)
) {
override fun toString(): String {
return "\"$title\" (id= $id) (sourceId= $sourceId)"
}
}

data class PagedMangaListDataClass(
val mangaList: List<MangaDataClass>,
Expand Down

0 comments on commit fc64f47

Please sign in to comment.