don't log imgui asserts unless we've shown them this session

This commit is contained in:
goat 2025-01-09 22:00:53 +01:00
parent 27b6dfcbea
commit da8be03124

View file

@ -24,6 +24,8 @@ internal class AssertHandler : IDisposable
// Store callback to avoid it from being GC'd // Store callback to avoid it from being GC'd
private readonly AssertCallbackDelegate callback; private readonly AssertCallbackDelegate callback;
private bool everShownAssertThisSession = false;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="AssertHandler"/> class. /// Initializes a new instance of the <see cref="AssertHandler"/> class.
/// </summary> /// </summary>
@ -76,6 +78,10 @@ internal class AssertHandler : IDisposable
if (this.ignoredAsserts.Contains(key)) if (this.ignoredAsserts.Contains(key))
return; return;
// Don't log unless we've ever shown an assert this session
if (!this.ShowAsserts && !this.everShownAssertThisSession)
return;
Lazy<string> stackTrace = new(() => new StackTrace(3).ToString()); Lazy<string> stackTrace = new(() => new StackTrace(3).ToString());
if (!this.EnableVerboseLogging) if (!this.EnableVerboseLogging)
@ -110,6 +116,8 @@ internal class AssertHandler : IDisposable
if (!this.ShowAsserts) if (!this.ShowAsserts)
return; return;
this.everShownAssertThisSession = true;
string? GetRepoUrl() string? GetRepoUrl()
{ {
// TODO: implot, imguizmo? // TODO: implot, imguizmo?