Skip to content

Commit

Permalink
Added logging scope for download
Browse files Browse the repository at this point in the history
  • Loading branch information
umerfaruk committed Sep 12, 2024
1 parent 8308ca3 commit 7da1888
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public DownloadRekhtaBookRequestHandler(

public override async Task<DownloadRekhtaBookRequest> HandleAsync(DownloadRekhtaBookRequest command, CancellationToken cancellationToken = new CancellationToken())
{
_logger.BeginScope("Downloading {Url} for {Library}", command.Url, _settings.DefaultLibraryId);
var book = await _bookRepository.GetBookBySource(_settings.DefaultLibraryId, command.Url, cancellationToken);
if (book != null)
{
Expand Down Expand Up @@ -221,7 +222,8 @@ private async Task DeleteBookPages(BookModel book, IEnumerable<BookPageModel> pa
await _bookPageRepository.DeletePage(_settings.DefaultLibraryId, book.Id, page.SequenceNumber, cancellationToken);
}
}
public async Task<BookModel> CreateNewBook(BookInfo bookInfo, string source, CancellationToken cancellationToken)

private async Task<BookModel> CreateNewBook(BookInfo bookInfo, string source, CancellationToken cancellationToken)
{
var authorName = bookInfo.Authors?.FirstOrDefault() ?? "Unknown";
var authors = await _authorRepository.FindAuthors(_settings.DefaultLibraryId, authorName, AuthorTypes.Writer, 1, 1, cancellationToken);
Expand Down

0 comments on commit 7da1888

Please sign in to comment.