From 72e88319f3f400c241782a3bd590e73611abe170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Sat, 30 Sep 2023 15:11:06 +0200 Subject: [PATCH] makes log output during scan less verbose --- PiwigoDirectorySync/Services/FileIndexer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PiwigoDirectorySync/Services/FileIndexer.cs b/PiwigoDirectorySync/Services/FileIndexer.cs index bce6e47..47fa4ab 100644 --- a/PiwigoDirectorySync/Services/FileIndexer.cs +++ b/PiwigoDirectorySync/Services/FileIndexer.cs @@ -117,8 +117,6 @@ internal class FileIndexer : IFileIndexer await using var tx = await db.Database.BeginTransactionAsync(IsolationLevel.Serializable, ct); var piwigoServer = await db.PiwigoServers.GetByIdAsync(serverId, ct); - _logger.Information("Get or crate album for directory {AlbumDirectory}", directory); - var albumId = await GetOrAddAlbumAsync(db, serverId, piwigoServer.RootDirectory, directory, ct); await tx.CommitAsync(ct); @@ -126,15 +124,17 @@ internal class FileIndexer : IFileIndexer }); } - private static async Task GetOrAddAlbumAsync(PersistenceContext db, int serverId, string rootDirectory, DirectoryInfo directory, CancellationToken ct) + private async Task GetOrAddAlbumAsync(PersistenceContext db, int serverId, string rootDirectory, DirectoryInfo directory, CancellationToken ct) { var albumPath = Path.GetRelativePath(rootDirectory, directory.FullName); var album = await db.PiwigoAlbums.FindByServerAndPathAsync(serverId, albumPath, ct); if (album != null) { + _logger.Debug("Found album with id {AlbumId} for directory {AlbumDirectory}", album.Id, directory); return album.Id; } + _logger.Information("creating album for directory {AlbumDirectory}", directory); int? parentAlbumId = null; if (!string.Equals(new DirectoryInfo(rootDirectory).FullName, directory.Parent!.FullName)) {