Update logger SignalR hub to use LogItemClient wire type

- Switched LoggerSignalRHub and SignaRClientLogItemWriter to use LogItemClient as the AcBinary wire type for symmetric client-server logging.
- Added LogItemClient.cs with AcBinary serialization attribute.
- Added direct AyCode.Entities.dll reference for base type resolution.
- Improved README docs for logger hub, client writer, and DI constructor fix.
- Updated build/test scripts and removed obsolete FbLogItem.cs.
This commit is contained in:
Loretta 2026-07-13 08:38:37 +02:00
parent d1217700b4
commit 71ffb4a2f6
8 changed files with 64 additions and 11 deletions

View File

@ -88,7 +88,15 @@
"PowerShell($dll = \"C:\\\\Users\\\\Fullepi\\\\.nuget\\\\packages\\\\devexpress.blazor\\\\25.1.5\\\\lib\\\\net8.0\\\\DevExpress.Blazor.v25.1.dll\"; $bytes = [System.IO.File]::ReadAllBytes\\($dll\\); $text = [System.Text.Encoding]::ASCII.GetString\\($bytes\\); @\\(\"BodyTemplate\",\"get_CssClass\",\"MessageBoxOptions\",\"TitleTemplate\"\\) | ForEach-Object { \"$\\($_\\): $\\($text.Contains\\($_\\)\\)\" })", "PowerShell($dll = \"C:\\\\Users\\\\Fullepi\\\\.nuget\\\\packages\\\\devexpress.blazor\\\\25.1.5\\\\lib\\\\net8.0\\\\DevExpress.Blazor.v25.1.dll\"; $bytes = [System.IO.File]::ReadAllBytes\\($dll\\); $text = [System.Text.Encoding]::ASCII.GetString\\($bytes\\); @\\(\"BodyTemplate\",\"get_CssClass\",\"MessageBoxOptions\",\"TitleTemplate\"\\) | ForEach-Object { \"$\\($_\\): $\\($text.Contains\\($_\\)\\)\" })",
"PowerShell(dotnet test \"H:\\\\Applications\\\\Aycode\\\\Source\\\\AyCode.Core\\\\AyCode.Services.Tests\\\\AyCode.Services.Tests.csproj\" --filter \"FullyQualifiedName~EkaerTradeCardValidatorTests\" --nologo -v quiet 2>$null)", "PowerShell(dotnet test \"H:\\\\Applications\\\\Aycode\\\\Source\\\\AyCode.Core\\\\AyCode.Services.Tests\\\\AyCode.Services.Tests.csproj\" --filter \"FullyQualifiedName~EkaerTradeCardValidatorTests\" --nologo -v quiet 2>$null)",
"PowerShell(dotnet build \"H:\\\\Applications\\\\Aycode\\\\Source\\\\AyCode.Core\\\\AyCode.Services.Server\\\\AyCode.Services.Server.csproj\" --nologo -v quiet 2>$null)", "PowerShell(dotnet build \"H:\\\\Applications\\\\Aycode\\\\Source\\\\AyCode.Core\\\\AyCode.Services.Server\\\\AyCode.Services.Server.csproj\" --nologo -v quiet 2>$null)",
"PowerShell(dotnet build \"H:\\\\Applications\\\\Aycode\\\\Source\\\\AyCode.Core\\\\AyCode.Services\\\\AyCode.Services.csproj\" -c Debug --nologo -v quiet 2>$null)" "PowerShell(dotnet build \"H:\\\\Applications\\\\Aycode\\\\Source\\\\AyCode.Core\\\\AyCode.Services\\\\AyCode.Services.csproj\" -c Debug --nologo -v quiet 2>$null)",
"PowerShell(dotnet build \"H:\\\\Applications\\\\Aycode\\\\Source\\\\AyCode.Core\\\\AyCode.Services.Server\\\\AyCode.Services.Server.csproj\" -c Debug --nologo -v quiet 2>$null)",
"PowerShell(\"=== Services.Server ===\")",
"PowerShell(dotnet build \"H:\\\\Applications\\\\Mango\\\\Source\\\\FruitBankHybridApp\\\\FruitBank.Common\\\\FruitBank.Common.csproj\" -c Debug --nologo -v quiet 2>$null)",
"PowerShell(dotnet build \"H:\\\\Applications\\\\Mango\\\\Source\\\\FruitBankHybridApp\\\\FruitBank.Common.Server\\\\FruitBank.Common.Server.csproj\" -c Debug --nologo -v quiet 2>$null)",
"PowerShell(\"=== FruitBank.Common.Server ===\")",
"PowerShell(Remove-Item \"H:\\\\Applications\\\\Mango\\\\Source\\\\FruitBankHybridApp\\\\FruitBank.Common\\\\Loggers\\\\FbLogItem.cs\" -Confirm:$false)",
"PowerShell(\"=== Server ===\")",
"PowerShell(\"=== Generated ===\")"
] ]
} }
} }

View File

@ -29,6 +29,10 @@
<Reference Include="AyCode.Core"> <Reference Include="AyCode.Core">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\$(Configuration)\net9.0\AyCode.Core.dll</HintPath> <HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\$(Configuration)\net9.0\AyCode.Core.dll</HintPath>
</Reference> </Reference>
<!-- FbLogItem : AcLogItemClient — a hub TLogItem-constraintjéhez kell a bázistípus assembly-je (a DLL-referencia nem tranzitív). -->
<Reference Include="AyCode.Entities">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\$(Configuration)\net9.0\AyCode.Entities.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces"> <Reference Include="AyCode.Interfaces">
<HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\$(Configuration)\net9.0\AyCode.Interfaces.dll</HintPath> <HintPath>..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Services.Server\bin\FruitBank\$(Configuration)\net9.0\AyCode.Interfaces.dll</HintPath>
</Reference> </Reference>

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,11 @@
using AyCode.Services.Server.SignalRs; using AyCode.Services.Server.SignalRs;
using FruitBank.Common.Loggers;
using FruitBank.Common.Server.Services.Loggers; using FruitBank.Common.Server.Services.Loggers;
namespace FruitBank.Common.Server.Services.SignalRs; namespace FruitBank.Common.Server.Services.SignalRs;
public class LoggerSignalRHub(LoggerToLoggerApiController logger) : AcLoggerSignalRHub<LoggerToLoggerApiController>(logger) // LogItemClient: a kliens-writerrel (SignaRClientLogItemWriter : AcSignaRClientLogItemWriter<LogItemClient>) azonos
{ } // wire-típus — a SignalR erre deserializál, AcBinary-nál a LogItemClient generált serializere fut.
public class LoggerSignalRHub(LoggerToLoggerApiController logger) : AcLoggerSignalRHub<LoggerToLoggerApiController, LogItemClient>(logger)
{ }

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,16 @@
using AyCode.Core.Serializers.Attributes;
using AyCode.Entities.LogItems;
namespace FruitBank.Common.Loggers;
/// <summary>
/// A FruitBank kliens↔szerver log-feltöltés wire-típusa (writer és loggerHub ugyanezt használja — szimmetrikus wire).
/// Az AcLogItemClient az AyCode.Entities generator-mentes rétegében él; itt, a FruitBank.Common-ban (ahol az
/// AcBinary source-generator fut) kap generált serializert — így a loggerHub AcBinary-protokollal mehet.
/// A generator az örökölt propertyket is felveszi (derived → base sorrend, runtime-kompatibilis).
/// Feature-ök kikapcsolva (false): kis, lapos POCO — id/ref/intern/metadata nem kell, a sorosítás így a leggyorsabb.
/// </summary>
[AcBinarySerializable(false)]
public class LogItemClient : AcLogItemClient
{
}

File diff suppressed because one or more lines are too long

View File

@ -1,17 +1,38 @@
using AyCode.Core.Enums; using AyCode.Core.Enums;
using AyCode.Core.Loggers; using AyCode.Core.Loggers;
using AyCode.Core.Serializers.Binaries;
using AyCode.Services.Loggers; using AyCode.Services.Loggers;
using AyCode.Services.SignalRs;
using Microsoft.Extensions.Logging.Abstractions;
namespace FruitBank.Common.Loggers namespace FruitBank.Common.Loggers
{ {
public class SignaRClientLogItemWriter : AcSignaRClientLogItemWriter /// <summary>
/// FruitBank log-feltöltő: LogItemClient wire-típussal, AcBinary-protokollon (egységes a fbHub-bal).
/// Cél: {BaseUrl}/loggerHub — a BaseUrl-t a host hidratálja az appsettings-ből.
/// </summary>
public class SignaRClientLogItemWriter : AcSignaRClientLogItemWriter<LogItemClient>
{ {
public SignaRClientLogItemWriter() : this(AppType.Web, LogLevel.Detail, null) public SignaRClientLogItemWriter() : this(AppType.Web, LogLevel.Detail, null)
{ {
} }
public SignaRClientLogItemWriter(AppType appType, LogLevel logLevel, string? categoryName = null) : base($"{FruitBankConstClient.BaseUrl}/{FruitBankConstClient.LoggerHubName}", appType, logLevel, categoryName) public SignaRClientLogItemWriter(AppType appType, LogLevel logLevel, string? categoryName = null)
: base($"{FruitBankConstClient.BaseUrl}/{FruitBankConstClient.LoggerHubName}", appType, logLevel, categoryName, CreateProtocolOptions())
{ {
} }
}
// ⚠️ VÉGTELEN-CIKLUS VESZÉLY — NE ADJ LOGGERT A PROTOKOLLNAK! ⚠️
// Ez a writer maga A log-feltöltő csatorna. Ha a protokoll loggert kapna (LoggerClient, ILogger, bármi,
// ami ebbe a writerbe torkollik), akkor minden feltöltés sorosítása ÚJABB log-sorokat termelne
// (Serialize start / WriteArgument / ...), amiket ez a writer megint felküldene → sorosítás → log → ...
// → robbanó visszacsatolás, a kliens másodpercek alatt megfullad.
// Ezért a Logger EXPLICIT NullLogger.Instance (nem null! — a null-t az AddAcBinaryProtocol ??= fallbackje
// a DI ILogger<AcBinaryHubProtocol>-jával pótolná, ami visszahozná a hurkot).
// Ugyanezért erre a hub-builderre AddAcDefaults/ConfigureLogging SOHA nem kerülhet.
private static AcBinaryHubProtocolOptions CreateProtocolOptions() => new()
{
ProtocolMode = BinaryProtocolMode.Bytes, // WASM-safe, ugyanaz, mint az fbHub-on
Logger = NullLogger.Instance, // süket logger — ld. a fenti figyelmeztetést
};
}
} }