diff --git a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/DownloadManager.kt b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/DownloadManager.kt index 18976d4bb5..e7daf48e3f 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/DownloadManager.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/DownloadManager.kt @@ -269,13 +269,13 @@ object DownloadManager { downloadQueue.add(newDownloadChapter) saveDownloadQueue() downloadSubscriptionSource.publish(newDownloadChapter) - logger.debug { "Added chapter ${chapter.id} to download queue (${manga.title} | ${chapter.name})" } + logger.debug { "Added chapter ${chapter.id} to download queue ($newDownloadChapter)" } return newDownloadChapter } val retryDownload = downloadChapter?.state == Error if (retryDownload) { - logger.debug { "Chapter ${chapter.id} download failed, retry download (${manga.title} | ${chapter.name})" } + logger.debug { "Chapter ${chapter.id} download failed, retry download ($downloadChapter)" } downloadChapter?.state = Queued downloadChapter?.progress = 0f @@ -283,7 +283,7 @@ object DownloadManager { return downloadChapter } - logger.debug { "Chapter ${chapter.id} already present in queue (${manga.title} | ${chapter.name})" } + logger.debug { "Chapter ${chapter.id} already present in queue ($downloadChapter)" } return null } @@ -297,7 +297,7 @@ object DownloadManager { } private fun dequeue(chapterDownloads: Set) { - logger.debug { "dequeue ${chapterDownloads.size} chapters [${chapterDownloads.joinToString(separator = ", ") { "${it.manga.title} (${it.mangaId}) - ${it.chapter.name} (${it.chapter.id})" }}]" } + logger.debug { "dequeue ${chapterDownloads.size} chapters [${chapterDownloads.joinToString(separator = ", ") { "$it" }}]" } downloadQueue.removeAll(chapterDownloads) saveDownloadQueue() @@ -310,7 +310,7 @@ object DownloadManager { val download = downloadQueue.find { it.mangaId == mangaId && it.chapterIndex == chapterIndex } ?: return - logger.debug { "reorder download ${download.manga.title} (${download.mangaId}) - ${download.chapter.name} (${download.chapter.id}) from ${downloadQueue.indexOf(download)} to $to" } + logger.debug { "reorder download $download from ${downloadQueue.indexOf(download)} to $to" } downloadQueue -= download downloadQueue.add(to, download) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/Downloader.kt b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/Downloader.kt index e2429a1ced..e00ac57818 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/Downloader.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/Downloader.kt @@ -88,7 +88,7 @@ class Downloader( (it.state == Queued || (it.state == Error && it.tries < 3)) // 3 re-tries per download } ?: break - val logContext = "${logger.name} - downloadChapter(${download.manga.title} (${download.mangaId}) - ${download.chapter.name} (${download.chapter.id}))" + val logContext = "${logger.name} - downloadChapter($download))" val downloadLogger = KotlinLogging.logger(logContext) downloadLogger.debug { "start" } diff --git a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/model/DownloadChapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/model/DownloadChapter.kt index f101150b69..2cd82654ad 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/model/DownloadChapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/model/DownloadChapter.kt @@ -19,4 +19,8 @@ class DownloadChapter( var state: DownloadState = Queued, var progress: Float = 0f, var tries: Int = 0 -) +) { + override fun toString(): String { + return "${manga.title} ($mangaId) - ${chapter.name} (${chapter.id}) | state= $state, tries= $tries, progress= $progress" + } +}