Enhance logging in FdsSqlOptions and related classes

- Updated FdsSqlOptions to accept an optional ILogger parameter for improved error logging.
- Modified FdsMfr and FdsMfrClient classes to pass the logger instance to FdsSqlOptions.
- Added detailed error logging in various methods to capture SQL execution issues and file handling errors.
- Improved documentation for FdsSqlOptions to clarify logging behavior.
- Updated Archive class to log compression errors, enhancing traceability of failures.
- Adjusted project configuration to suppress specific warnings related to transitive dependencies.
- Added NuGet.config to define package sources for dependency management.
- Updated submodule references for OCORE and related projects.
This commit is contained in:
Stefan
2026-07-03 20:22:05 +02:00
parent 1a3bf30442
commit 882e97509a
57 changed files with 2121 additions and 106 deletions
+10 -2
View File
@@ -1,5 +1,6 @@
using System.Globalization;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.Security.Claims;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
@@ -218,14 +219,21 @@ public class FuchsUserIdentity
// --------------------------- SQL options -------------------------------------
/// <summary>
/// Fuchs-specific SQL options — adds debug logging on error.
/// Fuchs-specific SQL options — logs every SQL error both to the app's structured
/// <see cref="ILogger"/>/OpenTelemetry pipeline and to the <c>fds__admin_logdebug</c> SQL
/// table (via <see cref="Fuchs_intranet.debug_log"/>). Handlers that don't separately inspect
/// the result's <c>.Exception</c> would otherwise return an empty/200 response on a failing
/// stored procedure with zero application-log signal — the DB table alone requires someone to
/// go looking for it.
/// </summary>
public class FIS_SQLOptions : sqloptions
{
public FIS_SQLOptions(Dictionary<string, object>? context = null)
public FIS_SQLOptions(Dictionary<string, object>? context = null, ILogger? logger = null)
{
OnError = (procedure, ex, data) =>
{
logger?.LogError(ex, "SQL error in {Procedure}: {Message} — context={@Context}",
procedure, ex.Message, context);
try { FuchsOcmsIntranet.Instance.debug_log($"SQL Error in {procedure}", ex, data: context); }
catch { }
};