debug(combat): add diagnostic logging to trace parser pipeline

Temporary verbose logs:
- CombatStatsTracker.Start() logs when timer starts
- ProcessChatLine logs first 3 invocations (text preview)
- OnSendTick logs first 3 sends (kill/damage/monster counts)

Will remove once we confirm the pipeline is working.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-12 09:55:49 +02:00
parent f71ae72935
commit 00d713a134
2 changed files with 15 additions and 0 deletions

View file

@ -44,6 +44,7 @@ namespace MosswartMassacre
_sendTimer.Interval = SendIntervalMs;
_sendTimer.Tick += OnSendTick;
_sendTimer.Start();
_logger?.Log("[CombatStats] Tracker started (10s send interval)");
}
public void Stop()
@ -67,6 +68,8 @@ namespace MosswartMassacre
// Public entry point — called from ChatEventRouter.OnChatText
// ═══════════════════════════════════════════════════════════════
private int _parseCount;
public void ProcessChatLine(string text)
{
if (string.IsNullOrEmpty(text)) return;
@ -82,6 +85,13 @@ namespace MosswartMassacre
// Skip non-combat chat (tells, channels, etc.)
if (IsNonCombatChat(text)) return;
// Diagnostic: log first few parses to verify the pipeline is live
if (_parseCount < 3)
{
_logger?.Log($"[CombatStats] ProcessChatLine invoked (#{_parseCount}): \"{text.Substring(0, Math.Min(text.Length, 80))}\"");
_parseCount++;
}
// Detect prefix flags (Mag-Tools does this via text.Contains)
bool isCrit = text.Contains("Critical hit!");
bool isOverpower = text.Contains("Overpower!");
@ -486,10 +496,15 @@ namespace MosswartMassacre
// Periodic send
// ═══════════════════════════════════════════════════════════════
private int _sendCount;
private void OnSendTick(object sender, EventArgs e)
{
if (!_dirty) return;
_dirty = false;
_sendCount++;
if (_sendCount <= 3)
_logger?.Log($"[CombatStats] Sending snapshot #{_sendCount}: {_sessionState.TotalKills} kills, {_sessionState.TotalDamageGiven} dmg given, {_sessionState.Monsters.Count} monsters");
try
{