Snapshot for release 2026.10.13.1 (internal 90a2f4a)
This commit is contained in:
parent
b0f9d74b21
commit
1d86acdf27
218 changed files with 24019 additions and 1517 deletions
|
|
@ -4,73 +4,67 @@ namespace RynthCore.Engine;
|
|||
|
||||
/// <summary>
|
||||
/// Centralised logging — every log call in the Engine routes through here.
|
||||
/// Toggle categories on/off at runtime to suppress entire subsystems.
|
||||
/// Messages keep their existing prefix text (e.g. "D3D9VTable: scanning…").
|
||||
/// Each category method writes at that category's emit level (engine.json "LogCategories",
|
||||
/// editable live from the launcher; see <see cref="LogSettings"/>), gated by the global
|
||||
/// "LoggingLevel". Messages keep their existing prefix text (e.g. "D3D9VTable: scanning…").
|
||||
/// </summary>
|
||||
internal static class RynthLog
|
||||
{
|
||||
// ── Category toggles (flip to false to silence a subsystem) ──────────
|
||||
|
||||
internal static bool D3D9Enabled = true;
|
||||
internal static bool CompatEnabled = true;
|
||||
internal static bool RenderEnabled = false; // ImGui, DX9Backend, Win32Backend
|
||||
internal static bool PluginEnabled = true;
|
||||
internal static bool UIEnabled = true;
|
||||
|
||||
// ── Category methods ─────────────────────────────────────────────────
|
||||
|
||||
/// <summary>D3D9 subsystem: vtable, EndScene, bootstrapper, matrix capture, nav3D.</summary>
|
||||
internal static void D3D9(string msg)
|
||||
{
|
||||
if (D3D9Enabled) Write(msg);
|
||||
}
|
||||
internal static void D3D9(string msg) => WriteCategory(LogCategory.D3D9, msg);
|
||||
|
||||
/// <summary>Compatibility hooks: SmartBox, client objects, combat, movement, vitals, chat, etc.</summary>
|
||||
internal static void Compat(string msg)
|
||||
{
|
||||
if (CompatEnabled) Write(msg);
|
||||
}
|
||||
internal static void Compat(string msg) => WriteCategory(LogCategory.Compat, msg);
|
||||
|
||||
/// <summary>ImGui rendering: context, DX9 backend, Win32 input, shell.</summary>
|
||||
internal static void Render(string msg)
|
||||
{
|
||||
if (RenderEnabled) Write(msg);
|
||||
}
|
||||
internal static void Render(string msg) => WriteCategory(LogCategory.Render, msg);
|
||||
|
||||
/// <summary>Plugin system: loader, manager, lifecycle callbacks.</summary>
|
||||
internal static void Plugin(string msg)
|
||||
{
|
||||
if (PluginEnabled) Write(msg);
|
||||
}
|
||||
/// <summary>Plugin system: loader, manager, lifecycle callbacks, plugin host Log lines.</summary>
|
||||
internal static void Plugin(string msg) => WriteCategory(LogCategory.Plugin, msg);
|
||||
|
||||
/// <summary>UI / Avalonia overlay subsystem.</summary>
|
||||
internal static void UI(string msg)
|
||||
{
|
||||
if (UIEnabled) Write(msg);
|
||||
}
|
||||
internal static void UI(string msg) => WriteCategory(LogCategory.UI, msg);
|
||||
|
||||
/// <summary>Verbose-only log (any category). Only written when VerboseLogging is on.</summary>
|
||||
internal static void Verbose(string msg)
|
||||
{
|
||||
if (EntryPoint.VerboseLogging) Write(msg);
|
||||
}
|
||||
/// <summary>Verbose detail (any subsystem). Debug by default; set the Verbose category to Info to see it in the normal log.</summary>
|
||||
internal static void Verbose(string msg) => WriteCategory(LogCategory.Verbose, msg);
|
||||
|
||||
/// <summary>Always-on log for critical / uncategorised messages (INFO).</summary>
|
||||
internal static void Info(string msg) => Write(msg);
|
||||
/// <summary>Same as <see cref="Verbose"/>.</summary>
|
||||
internal static void Debug(string msg) => WriteCategory(LogCategory.Verbose, msg);
|
||||
|
||||
/// <summary>Trace-level line: written only when the global level is Trace.</summary>
|
||||
internal static void Trace(string msg) => WriteAt(EntryPoint.EngineLogLevel.Trace, msg);
|
||||
|
||||
/// <summary>Uncategorised line (General category, Info by default).</summary>
|
||||
internal static void Info(string msg) => WriteCategory(LogCategory.General, msg);
|
||||
|
||||
/// <summary>Same as <see cref="Warn"/>.</summary>
|
||||
internal static void Warning(string msg) => Warn(msg);
|
||||
|
||||
// Most recent WRN/ERR text + when, surfaced via the GetEngineStatusJson host bridge so a stuck box
|
||||
// can be diagnosed remotely without reading the PC log.
|
||||
// can be diagnosed remotely without reading the PC log. Recorded even when the line is filtered.
|
||||
internal static volatile string? LastIssue;
|
||||
internal static DateTime LastIssueUtc;
|
||||
|
||||
/// <summary>Always-on WARN line — a recoverable problem worth grepping for.</summary>
|
||||
/// <summary>WARN line — a recoverable problem worth grepping for. Hidden only at level Error/Off.</summary>
|
||||
internal static void Warn(string msg)
|
||||
{
|
||||
LastIssue = msg; LastIssueUtc = DateTime.UtcNow;
|
||||
EntryPoint.LogTagged("engine", msg, "WRN");
|
||||
if (EntryPoint.ShouldLog(EntryPoint.EngineLogLevel.Warning))
|
||||
EntryPoint.LogTagged("engine", msg, "WRN");
|
||||
}
|
||||
|
||||
/// <summary>Always-on ERROR line — a fault/crash/disable. Triage with grep "[ERR]".</summary>
|
||||
/// <summary>
|
||||
/// Always-on heartbeat line, written at every LoggingLevel (Off included). The launcher's
|
||||
/// wedge watchdog reads RynthCore.<pid>.log going quiet for 120 s as a dead engine and
|
||||
/// kills the client, so this line must never be filtered: on 2026-10-06 LoggingLevel=Info
|
||||
/// with General=Trace dropped it and healthy in-world clients were killed and relaunched
|
||||
/// every few minutes.
|
||||
/// </summary>
|
||||
internal static void Heartbeat(string msg) => EntryPoint.LogTagged("engine", msg, "INF");
|
||||
|
||||
/// <summary>Always-on ERROR line — a fault/crash/disable, written even at level Off. Triage with grep "[ERR]".</summary>
|
||||
internal static void Error(string msg)
|
||||
{
|
||||
LastIssue = msg; LastIssueUtc = DateTime.UtcNow;
|
||||
|
|
@ -154,7 +148,24 @@ internal static class RynthLog
|
|||
: $"thread {Environment.CurrentManagedThreadId}";
|
||||
}
|
||||
|
||||
/// <summary>True when a line in <paramref name="category"/> would be written (guard expensive messages).</summary>
|
||||
internal static bool IsEnabled(LogCategory category) => LogSettings.IsEnabled(category);
|
||||
|
||||
// ── Sink ─────────────────────────────────────────────────────────────
|
||||
|
||||
private static void Write(string message) => EntryPoint.Log(message);
|
||||
/// <summary>Uncategorised line (General category); used by the Move/UseDone traces.</summary>
|
||||
private static void Write(string? message)
|
||||
{
|
||||
if (message != null)
|
||||
WriteCategory(LogCategory.General, message);
|
||||
}
|
||||
|
||||
private static void WriteCategory(LogCategory category, string message)
|
||||
=> WriteAt(LogSettings.LevelFor(category), message);
|
||||
|
||||
private static void WriteAt(EntryPoint.EngineLogLevel level, string message)
|
||||
{
|
||||
if (EntryPoint.ShouldLog(level))
|
||||
EntryPoint.LogTagged("engine", message, LogSettings.Tag(level));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue