mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-02-18 00:17:43 +01:00
Verify correct Serilog parameters used (#1536 )
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 { }
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user