From 1e99bdd2c7ee3bef7441b14bbc767c89d3eccbfb Mon Sep 17 00:00:00 2001 From: webmaster442 Date: Fri, 6 Mar 2026 10:41:10 +0100 Subject: [PATCH 1/2] Better logging of critical errors --- Changelog.md | 4 ++++ Source/BookGen.Shell.Shared/BrowserInteract.cs | 6 +++--- Source/BookGen.Shell.Shared/Loging/ConsoleLogProvider.cs | 4 +--- Source/BookGen.Shellprog/OrganizeCommand.cs | 4 ++-- Source/BookGen/Commands/EditCommand.cs | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Changelog.md b/Changelog.md index 850712c2..807a2ae3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,7 @@ +# Next + +* Change: Better logging of critical errors + # 2026. 03. 04 (Prerelease) * Change: Updated dependencies diff --git a/Source/BookGen.Shell.Shared/BrowserInteract.cs b/Source/BookGen.Shell.Shared/BrowserInteract.cs index a8ebd9df..c61aaf4c 100644 --- a/Source/BookGen.Shell.Shared/BrowserInteract.cs +++ b/Source/BookGen.Shell.Shared/BrowserInteract.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// (c) 2019-2025 Ruzsinszki Gábor +// (c) 2019-2026 Ruzsinszki Gábor // This code is licensed under MIT license (see LICENSE for details) //----------------------------------------------------------------------------- @@ -78,7 +78,7 @@ public async Task Html2Pdf(string input, string output) } catch (Exception ex) { - _logger.LogCritical(ex, "Critical Error"); + _logger.LogCritical(ex, "Critical Error: {ex}", ex.Message); return false; } } @@ -111,7 +111,7 @@ public async Task Html2Png(string input, } catch (Exception ex) { - _logger.LogCritical(ex, "Critical Error"); + _logger.LogCritical(ex, "Critical Error {ex}", ex.Message); return false; } } diff --git a/Source/BookGen.Shell.Shared/Loging/ConsoleLogProvider.cs b/Source/BookGen.Shell.Shared/Loging/ConsoleLogProvider.cs index 02534223..44ff26e8 100644 --- a/Source/BookGen.Shell.Shared/Loging/ConsoleLogProvider.cs +++ b/Source/BookGen.Shell.Shared/Loging/ConsoleLogProvider.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// (c) 2019-2025 Ruzsinszki Gábor +// (c) 2019-2026 Ruzsinszki Gábor // This code is licensed under MIT license (see LICENSE for details) //----------------------------------------------------------------------------- @@ -44,13 +44,11 @@ public void Dispose() internal sealed class ConsoleLogger : IDisposable, ILogger { - private readonly string _name; private readonly List _logBuffer; public ConsoleLogger(string categoryName) { _logBuffer = new List(); - _name = categoryName; } public IDisposable? BeginScope(TState state) where TState : notnull diff --git a/Source/BookGen.Shellprog/OrganizeCommand.cs b/Source/BookGen.Shellprog/OrganizeCommand.cs index a9e1346b..d697c65c 100644 --- a/Source/BookGen.Shellprog/OrganizeCommand.cs +++ b/Source/BookGen.Shellprog/OrganizeCommand.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// (c) 2019-2025 Ruzsinszki Gábor +// (c) 2019-2026 Ruzsinszki Gábor // This code is licensed under MIT license (see LICENSE for details) //----------------------------------------------------------------------------- @@ -33,7 +33,7 @@ public override int Execute(OrganizeArguments arguments, IReadOnlyList c } catch (Exception ex) { - _log.LogCritical(ex, "Critical error"); + _log.LogCritical(ex, "Critical error: {msg}", ex.Message); return -1; } } diff --git a/Source/BookGen/Commands/EditCommand.cs b/Source/BookGen/Commands/EditCommand.cs index b59d9363..fedf2969 100644 --- a/Source/BookGen/Commands/EditCommand.cs +++ b/Source/BookGen/Commands/EditCommand.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// (c) 2019-2025 Ruzsinszki Gábor +// (c) 2019-2026 Ruzsinszki Gábor // This code is licensed under MIT license (see LICENSE for details) //----------------------------------------------------------------------------- @@ -77,7 +77,7 @@ public override int Execute(IReadOnlyList context) } catch (Exception ex) { - _log.LogCritical(ex, "Critical Error"); + _log.LogCritical(ex, "Critical Error: {ex}", ex.Message); return ExitCodes.GeneralError; } } From 6dc3015f7fe6cdc9e9ca7a6ba9d11a6a5ac9beb7 Mon Sep 17 00:00:00 2001 From: webmaster442 Date: Fri, 6 Mar 2026 10:45:09 +0100 Subject: [PATCH 2/2] Linguist update --- .gitattributes | 6 ++++-- BookGen.slnx | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 5b9a185d..82318a9a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,8 +6,10 @@ # Auto detect text files and perform LF normalization * text=auto -# exlude assets -Assets/* linguist-vendored +## Linguist + +Assets/BundledAssets/* linguist-vendored +Assets/dictionaries/* linguist-vendored # # The above will handle all files NOT found below diff --git a/BookGen.slnx b/BookGen.slnx index 1ac763dc..c1ea91fb 100644 --- a/BookGen.slnx +++ b/BookGen.slnx @@ -1,6 +1,8 @@ + +