Rework startup topic handling and reenable output to logging framework (#14243)

This commit is contained in:
JPVenson
2025-06-09 04:52:39 +03:00
committed by GitHub
parent d7faf9a327
commit 1e9e4ffda9
16 changed files with 255 additions and 60 deletions

View File

@@ -71,7 +71,7 @@ public sealed class SetupServer : IDisposable
_configurationManager.RegisterConfiguration<NetworkConfigurationFactory>();
}
internal static ConcurrentQueue<StartupLogEntry>? LogQueue { get; set; } = new();
internal static ConcurrentQueue<StartupLogTopic>? LogQueue { get; set; } = new();
/// <summary>
/// Gets a value indicating whether Startup server is currently running.
@@ -88,12 +88,12 @@ public sealed class SetupServer : IDisposable
_startupUiRenderer = (await ParserOptionsBuilder.New()
.WithTemplate(fileTemplate)
.WithFormatter(
(StartupLogEntry logEntry, IEnumerable<StartupLogEntry> children) =>
(StartupLogTopic logEntry, IEnumerable<StartupLogTopic> children) =>
{
if (children.Any())
{
var maxLevel = logEntry.LogLevel;
var stack = new Stack<StartupLogEntry>(children);
var stack = new Stack<StartupLogTopic>(children);
while (maxLevel != LogLevel.Error && stack.Count > 0 && (logEntry = stack.Pop()) != null) // error is the highest inherted error level.
{
@@ -362,15 +362,4 @@ public sealed class SetupServer : IDisposable
});
}
}
internal class StartupLogEntry
{
public LogLevel LogLevel { get; set; }
public string? Content { get; set; }
public DateTimeOffset DateOfCreation { get; set; }
public List<StartupLogEntry> Children { get; set; } = [];
}
}