Skip to content

Commit

Permalink
[Logging] Update logs
Browse files Browse the repository at this point in the history
  • Loading branch information
schroda committed Nov 5, 2023
1 parent 4970e97 commit d40eda4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,16 @@ object Chapter {
prevNumberOfChapters: Int,
updatedChapterList: List<ResultRow>,
) {
val log =
KotlinLogging.logger(
"${logger.name}::downloadNewChapters(" +
"mangaId= $mangaId, " +
"prevNumberOfChapters= $prevNumberOfChapters, " +
"updatedChapterList= ${updatedChapterList.size}, " +
"downloadAheadLimit= ${serverConfig.autoDownloadAheadLimit.value}" +
")",
)

// convert numbers to be index based
val newNumberOfChapters = updatedChapterList.size
val numberOfNewChapters = newNumberOfChapters - prevNumberOfChapters
Expand All @@ -309,6 +319,7 @@ object Chapter {
val isDownloadPossible =
serverConfig.autoDownloadNewChapters.value && areNewChaptersAvailable && !wasInitialFetch
if (!isDownloadPossible) {
log.debug { "download is not allowed" }
return
}

Expand All @@ -323,6 +334,7 @@ object Chapter {

val skipDueToUnreadChapters = serverConfig.excludeEntryWithUnreadChapters.value && unreadChapters.isNotEmpty()
if (skipDueToUnreadChapters) {
log.debug { "ignore due to unread chapters" }
return
}

Expand All @@ -339,10 +351,11 @@ object Chapter {
.map { it[ChapterTable.id].value }

if (chapterIdsToDownload.isEmpty()) {
log.debug { "no chapters available for download" }
return
}

logger.info { "downloadNewChapters($mangaId): Downloading \"${chapterIdsToDownload.size}\" new chapter(s)..." }
log.info { "download ${chapterIdsToDownload.size} new chapter(s)..." }

DownloadManager.enqueue(EnqueueInput(chapterIdsToDownload))
}
Expand Down

0 comments on commit d40eda4

Please sign in to comment.