From 3fa805d51f80dc364cfde17463de344b59e72d23 Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Wed, 7 Jan 2026 15:10:54 -0700 Subject: [PATCH] Verify correct Serilog parameters used (#1536 ) --- Source/AppScaffolding/LibationScaffolding.cs | 4 ++-- Source/DtoImporterService/CategoryImporter.cs | 2 +- Source/FileLiberator/AudioFormatDecoder.cs | 4 ++-- Source/FileLiberator/DownloadDecryptBook.cs | 12 ++++++------ Source/FileLiberator/DownloadOptions.Factory.cs | 4 ++-- Source/FileManager/FileSystemTest.cs | 10 +++++----- Source/FileManager/PersistentDictionary.cs | 2 +- Source/LibationCli/Options/LiberateOptions.cs | 2 +- Source/LibationFileManager/AudibleFileStorage.cs | 6 +++--- Source/LibationFileManager/InteropFactory.cs | 2 +- Source/LibationFileManager/LibationFiles.cs | 10 +++++----- .../FindBetterQualityBooksViewModel.cs | 2 +- .../ProcessQueue/ProcessQueueViewModel.cs | 8 ++++---- 13 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Source/AppScaffolding/LibationScaffolding.cs b/Source/AppScaffolding/LibationScaffolding.cs index 72e262a7..72f3de07 100644 --- a/Source/AppScaffolding/LibationScaffolding.cs +++ b/Source/AppScaffolding/LibationScaffolding.cs @@ -121,7 +121,7 @@ namespace AppScaffolding } catch(Exception ex) { - Log.Logger.Warning(ex, "Could not delete SQLite WAL file: {@WalFile}", walFile); + Log.Logger.Warning(ex, "Could not delete SQLite WAL file: {WalFile}", walFile); } } if (File.Exists(shmFile)) @@ -132,7 +132,7 @@ namespace AppScaffolding } catch (Exception ex) { - Log.Logger.Warning(ex, "Could not delete SQLite SHM file: {@ShmFile}", shmFile); + Log.Logger.Warning(ex, "Could not delete SQLite SHM file: {ShmFile}", shmFile); } } } diff --git a/Source/DtoImporterService/CategoryImporter.cs b/Source/DtoImporterService/CategoryImporter.cs index d4c81ed2..f33aa5d8 100644 --- a/Source/DtoImporterService/CategoryImporter.cs +++ b/Source/DtoImporterService/CategoryImporter.cs @@ -87,7 +87,7 @@ namespace DtoImporterService } catch (Exception ex) { - Serilog.Log.Logger.Error(ex, "Error adding category ladder. {@DebugInfo}", categoryList); + Serilog.Log.Logger.Error(ex, "Error adding category ladder."); throw; } } diff --git a/Source/FileLiberator/AudioFormatDecoder.cs b/Source/FileLiberator/AudioFormatDecoder.cs index 33d0761e..9d96d952 100644 --- a/Source/FileLiberator/AudioFormatDecoder.cs +++ b/Source/FileLiberator/AudioFormatDecoder.cs @@ -67,7 +67,7 @@ public static class AudioFormatDecoder var mpegSize = mp3File.Length - mp3File.Position; if (mpegSize < 64) { - Serilog.Log.Logger.Warning("Remaining file length is too short to contain any mp3 frames. {@File}", mp3Filename); + Serilog.Log.Logger.Warning("Remaining file length is too short to contain any mp3 frames. {File}", mp3Filename); return AudioFormat.Default; } @@ -80,7 +80,7 @@ public static class AudioFormatDecoder if (layerDesc is not Layer.Layer_3) { - Serilog.Log.Logger.Warning("Could not read mp3 data from {@layerVersion} file.", layerDesc.ToString()); + Serilog.Log.Logger.Warning("Could not read mp3 data from {layerVersion} file.", layerDesc); return AudioFormat.Default; } diff --git a/Source/FileLiberator/DownloadDecryptBook.cs b/Source/FileLiberator/DownloadDecryptBook.cs index 4897ec79..59867b6d 100644 --- a/Source/FileLiberator/DownloadDecryptBook.cs +++ b/Source/FileLiberator/DownloadDecryptBook.cs @@ -427,7 +427,7 @@ namespace FileLiberator { //Failure to download cover art should not be considered a failure to download the book if (!cancellationToken.IsCancellationRequested) - Serilog.Log.Logger.Error(ex, "Error downloading cover art for {@Book} to {@metadataFile}.", options.LibraryBook.LogFriendly(), coverPath); + Serilog.Log.Logger.Error(ex, "Error downloading cover art for {@Book} to {coverPath}.", options.LibraryBook.LogFriendly(), coverPath); throw; } } @@ -476,7 +476,7 @@ namespace FileLiberator { //Failure to download records should not be considered a failure to download the book if (!cancellationToken.IsCancellationRequested) - Serilog.Log.Logger.Error(ex, "Error downloading clips and bookmarks for {@Book} to {@recordsPath}.", options.LibraryBook.LogFriendly(), recordsPath); + Serilog.Log.Logger.Error(ex, "Error downloading clips and bookmarks for {@Book} to {recordsPath}.", options.LibraryBook.LogFriendly(), recordsPath); throw; } } @@ -512,7 +512,7 @@ namespace FileLiberator { //Failure to download metadata should not be considered a failure to download the book if (!cancellationToken.IsCancellationRequested) - Serilog.Log.Logger.Error(ex, "Error downloading metadata of {@Book} to {@metadataFile}.", options.LibraryBook.LogFriendly(), metadataPath); + Serilog.Log.Logger.Error(ex, "Error downloading metadata of {@Book} to {metadataFile}.", options.LibraryBook.LogFriendly(), metadataPath); throw; } } @@ -523,12 +523,12 @@ namespace FileLiberator { Serilog.Log.Verbose("Getting destination directory for {@Book}", libraryBook.LogFriendly()); var destinationDir = AudibleFileStorage.Audio.GetDestinationDirectory(libraryBook, Configuration); - Serilog.Log.Verbose("Got destination directory for {@Book}. {@Directory}", libraryBook.LogFriendly(), destinationDir); + Serilog.Log.Verbose("Got destination directory for {@Book}. {Directory}", libraryBook.LogFriendly(), destinationDir); if (!Directory.Exists(destinationDir)) { - Serilog.Log.Verbose("Creating destination {@Directory}", destinationDir); + Serilog.Log.Verbose("Creating destination {Directory}", destinationDir); Directory.CreateDirectory(destinationDir); - Serilog.Log.Verbose("Created destination {@Directory}", destinationDir); + Serilog.Log.Verbose("Created destination {Directory}", destinationDir); } return destinationDir; } diff --git a/Source/FileLiberator/DownloadOptions.Factory.cs b/Source/FileLiberator/DownloadOptions.Factory.cs index 4a78f64c..7f3fd0a8 100644 --- a/Source/FileLiberator/DownloadOptions.Factory.cs +++ b/Source/FileLiberator/DownloadOptions.Factory.cs @@ -56,7 +56,7 @@ public partial class DownloadOptions } else if (metadata.ContentReference != license.ContentMetadata.ContentReference) { - Serilog.Log.Logger.Warning("Metadata ContentReference does not match License ContentReference with drm_type = {@DrmType}. {@Metadata}. {@License} ", + Serilog.Log.Logger.Warning("Metadata ContentReference does not match License ContentReference with drm_type = {DrmType}. {@Metadata}. {@License} ", license.DrmType, metadata.ContentReference, license.ContentMetadata.ContentReference); @@ -111,7 +111,7 @@ public partial class DownloadOptions if (canUseWidevine) Serilog.Log.Logger.Warning("Unable to get a Widevine CDM. Falling back to ADRM."); else - Serilog.Log.Logger.Warning("Account {@account} is not registered as an android device, so content will not be downloaded with Widevine DRM. Remove and re-add the account in Libation to fix.", libraryBook.Account.ToMask()); + Serilog.Log.Logger.Warning("Account {account} is not registered as an android device, so content will not be downloaded with Widevine DRM. Remove and re-add the account in Libation to fix.", libraryBook.Account.ToMask()); } token.ThrowIfCancellationRequested(); diff --git a/Source/FileManager/FileSystemTest.cs b/Source/FileManager/FileSystemTest.cs index c8be82bf..27efd98f 100644 --- a/Source/FileManager/FileSystemTest.cs +++ b/Source/FileManager/FileSystemTest.cs @@ -46,7 +46,7 @@ namespace FileManager if (!Directory.Exists(directoryName)) return false; - Serilog.Log.Logger.Debug("Testing write permissions for directory: {@DirectoryName}", directoryName); + Serilog.Log.Logger.Debug("Testing write permissions for directory: {DirectoryName}", directoryName); var testFilePath = Path.Combine(directoryName, Guid.NewGuid().ToString()); return CanWriteFile(testFilePath); } @@ -55,9 +55,9 @@ namespace FileManager { try { - Serilog.Log.Logger.Debug("Testing ability to write filename: {@filename}", filename); + Serilog.Log.Logger.Debug("Testing ability to write filename: {filename}", filename); File.WriteAllBytes(filename, []); - Serilog.Log.Logger.Debug("Deleting test file after successful write: {@filename}", filename); + Serilog.Log.Logger.Debug("Deleting test file after successful write: {filename}", filename); try { FileUtility.SaferDelete(filename); @@ -65,13 +65,13 @@ namespace FileManager catch (Exception ex) { //An error deleting the file doesn't constitute a write failure. - Serilog.Log.Logger.Debug(ex, "Error deleting test file: {@filename}", filename); + Serilog.Log.Logger.Debug(ex, "Error deleting test file: {filename}", filename); } return true; } catch (Exception ex) { - Serilog.Log.Logger.Debug(ex, "Error writing test file: {@filename}", filename); + Serilog.Log.Logger.Debug(ex, "Error writing test file: {filename}", filename); return false; } } diff --git a/Source/FileManager/PersistentDictionary.cs b/Source/FileManager/PersistentDictionary.cs index 62aaee61..6594ba5b 100644 --- a/Source/FileManager/PersistentDictionary.cs +++ b/Source/FileManager/PersistentDictionary.cs @@ -142,7 +142,7 @@ namespace FileManager File.WriteAllText(Filepath, endContents); success = true; } - Serilog.Log.Logger.Information("Removed property. {@DebugInfo}", propertyName); + Serilog.Log.Logger.Information("Removed property. {propertyName}", propertyName); } catch { } diff --git a/Source/LibationCli/Options/LiberateOptions.cs b/Source/LibationCli/Options/LiberateOptions.cs index 3a1ef9db..adcd9b5a 100644 --- a/Source/LibationCli/Options/LiberateOptions.cs +++ b/Source/LibationCli/Options/LiberateOptions.cs @@ -87,7 +87,7 @@ namespace LibationCli } catch (Exception ex) { - Serilog.Log.Error(ex, "Failed to read license file: {@LicenseFile}", licFile); + Serilog.Log.Error(ex, "Failed to read license file: {LicenseFile}", licFile); Console.Error.WriteLine("Error: Failed to read license file. Please ensure the file is a valid license file in JSON format."); } return null; diff --git a/Source/LibationFileManager/AudibleFileStorage.cs b/Source/LibationFileManager/AudibleFileStorage.cs index c97e0ecb..afacce15 100644 --- a/Source/LibationFileManager/AudibleFileStorage.cs +++ b/Source/LibationFileManager/AudibleFileStorage.cs @@ -37,7 +37,7 @@ namespace LibationFileManager } catch (Exception ex) { - Serilog.Log.Error(ex, "Error creating subdirectory in {@InProgress}", Configuration.Instance.InProgress); + Serilog.Log.Error(ex, "Error creating subdirectory in {InProgress}", Configuration.Instance.InProgress); lastInProgressFail = DateTime.UtcNow; return null; } @@ -86,7 +86,7 @@ namespace LibationFileManager } catch (Exception ex) { - Serilog.Log.Error(ex, "Error creating Books directory: {@BooksDirectory}", Configuration.Instance.Books); + Serilog.Log.Error(ex, "Error creating Books directory: {BooksDirectory}", Configuration.Instance.Books); return null; } } @@ -272,7 +272,7 @@ namespace LibationFileManager } catch (Exception ex) { - Serilog.Log.Error(ex, "Error checking for asin in {@file}", path); + Serilog.Log.Error(ex, "Error checking for asin in {file}", path); } finally { diff --git a/Source/LibationFileManager/InteropFactory.cs b/Source/LibationFileManager/InteropFactory.cs index 043535d4..cfb9598a 100644 --- a/Source/LibationFileManager/InteropFactory.cs +++ b/Source/LibationFileManager/InteropFactory.cs @@ -76,7 +76,7 @@ namespace LibationFileManager catch (Exception e) { //None of the interop functions are strictly necessary for Libation to run. - Serilog.Log.Logger.Error(e, "Unable to load types from assembly {@configApp}", configApp); + Serilog.Log.Logger.Error(e, "Unable to load types from assembly {configApp}", configApp); } } private static string? getOSConfigApp() diff --git a/Source/LibationFileManager/LibationFiles.cs b/Source/LibationFileManager/LibationFiles.cs index 7e1a249e..dc9bcde0 100644 --- a/Source/LibationFileManager/LibationFiles.cs +++ b/Source/LibationFileManager/LibationFiles.cs @@ -114,24 +114,24 @@ public class LibationFiles } catch (Exception ex) { - Log.Logger.Error(ex, "Failed to load settings file: {@SettingsFile}", settingsFile); + Log.Logger.Error(ex, "Failed to load settings file: {SettingsFile}", settingsFile); try { - Log.Logger.Information("Deleting invalid settings file: {@SettingsFile}", settingsFile); + Log.Logger.Information("Deleting invalid settings file: {SettingsFile}", settingsFile); FileUtility.SaferDelete(settingsFile); - Log.Logger.Information("Creating a new, empty setting file: {@SettingsFile}", settingsFile); + Log.Logger.Information("Creating a new, empty setting file: {SettingsFile}", settingsFile); try { File.WriteAllText(settingsFile, "{}"); } catch (Exception createEx) { - Log.Logger.Error(createEx, "Failed to create new settings file: {@SettingsFile}", settingsFile); + Log.Logger.Error(createEx, "Failed to create new settings file: {SettingsFile}", settingsFile); } } catch (Exception deleteEx) { - Log.Logger.Error(deleteEx, "Failed to delete the invalid settings file: {@SettingsFile}", settingsFile); + Log.Logger.Error(deleteEx, "Failed to delete the invalid settings file: {SettingsFile}", settingsFile); } return false; diff --git a/Source/LibationUiBase/FindBetterQualityBooksViewModel.cs b/Source/LibationUiBase/FindBetterQualityBooksViewModel.cs index 2c182ec1..c917c935 100644 --- a/Source/LibationUiBase/FindBetterQualityBooksViewModel.cs +++ b/Source/LibationUiBase/FindBetterQualityBooksViewModel.cs @@ -150,7 +150,7 @@ public class FindBetterQualityBooksViewModel : ReactiveObject } catch (Exception ex) { - Serilog.Log.Logger.Error(ex, "Error checking for better quality for {@Asin}", b.Asin); + Serilog.Log.Logger.Error(ex, "Error checking for better quality for {@Asin}", new { b.Asin }); b.FoundFile = $"Error: {ex.Message}"; b.ScanStatus = ProcessBookStatus.Failed; } diff --git a/Source/LibationUiBase/ProcessQueue/ProcessQueueViewModel.cs b/Source/LibationUiBase/ProcessQueue/ProcessQueueViewModel.cs index 252271e6..92115bad 100644 --- a/Source/LibationUiBase/ProcessQueue/ProcessQueueViewModel.cs +++ b/Source/LibationUiBase/ProcessQueue/ProcessQueueViewModel.cs @@ -168,7 +168,7 @@ public class ProcessQueueViewModel : ReactiveObject private bool IsBooksDirectoryValid(Configuration config) { - if (string.IsNullOrWhiteSpace(config.Books)) + if (string.IsNullOrWhiteSpace(config.Books?.Path)) { Serilog.Log.Logger.Error("Books location is not set in configuration."); MessageBoxBase.Show( @@ -180,7 +180,7 @@ public class ProcessQueueViewModel : ReactiveObject } else if (AudibleFileStorage.BooksDirectory is null) { - Serilog.Log.Logger.Error("Failed to create books directory: {@booksDir}", config.Books); + Serilog.Log.Logger.Error("Failed to create books directory: {booksDir}", config.Books?.Path); MessageBoxBase.Show( $"Libation was unable to create the \"Books location\" folder at:\n{config.Books}\n\nPlease change the Books location in the settings menu.", "Failed to Create Books Directory", @@ -190,7 +190,7 @@ public class ProcessQueueViewModel : ReactiveObject } else if (AudibleFileStorage.DownloadsInProgressDirectory is null) { - Serilog.Log.Logger.Error("Failed to create DownloadsInProgressDirectory in {@InProgress}", config.InProgress); + Serilog.Log.Logger.Error("Failed to create DownloadsInProgressDirectory in {InProgress}", config.InProgress); MessageBoxBase.Show( $"Libation was unable to create the \"Downloads In Progress\" folder in:\n{config.InProgress}\n\nPlease change the In Progress location in the settings menu.", "Failed to Create Downloads In Progress Directory", @@ -200,7 +200,7 @@ public class ProcessQueueViewModel : ReactiveObject } else if (AudibleFileStorage.DecryptInProgressDirectory is null) { - Serilog.Log.Logger.Error("Failed to create DecryptInProgressDirectory in {@InProgress}", config.InProgress); + Serilog.Log.Logger.Error("Failed to create DecryptInProgressDirectory in {InProgress}", config.InProgress); MessageBoxBase.Show( $"Libation was unable to create the \"Decrypt In Progress\" folder in:\n{config.InProgress}\n\nPlease change the In Progress location in the settings menu.", "Failed to Create Decrypt In Progress Directory",