Skip to content

Commit 831a744

Browse files
committed
fix(daemon): log event rule ids
1 parent 255bcbf commit 831a744

2 files changed

Lines changed: 47 additions & 5 deletions

File tree

MCServerLauncher.Daemon/Remote/Event/EventTriggerService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ private bool EvaluateRulesets(IInstance instance, EventRule rule)
165165
break;
166166
default:
167167
_logger.LogWarning(
168-
"Unsupported ruleset type '{RulesetType}' for rule '{RuleName}' on instance '{InstanceId}'",
168+
"Unsupported ruleset type '{RulesetType}' for rule '{RuleId}' on instance '{InstanceId}'",
169169
ruleset?.GetType().Name ?? "<null>",
170-
rule.Name,
170+
rule.Id,
171171
instance.Config.Uuid);
172172
return false;
173173
}
@@ -180,11 +180,11 @@ private async Task ExecuteActionsAsync(IInstance instance, EventRule rule)
180180
{
181181
if (!EvaluateRulesets(instance, rule))
182182
{
183-
_logger.LogDebug("Rulesets did not match for rule '{RuleName}' on instance '{InstanceId}'", rule.Name, instance.Config.Uuid);
183+
_logger.LogDebug("Rulesets did not match for rule '{RuleId}' on instance '{InstanceId}'", rule.Id, instance.Config.Uuid);
184184
return;
185185
}
186186

187-
_logger.LogInformation("Executing rule '{RuleName}' for instance '{InstanceId}' in {Mode} mode", rule.Name, instance.Config.Uuid, rule.ActionExecutionMode);
187+
_logger.LogInformation("Executing rule '{RuleId}' for instance '{InstanceId}' in {Mode} mode", rule.Id, instance.Config.Uuid, rule.ActionExecutionMode);
188188

189189
if (string.Equals(rule.ActionExecutionMode, "Parallel", StringComparison.OrdinalIgnoreCase))
190190
{
@@ -236,7 +236,7 @@ private async Task ExecuteSingleActionAsync(IInstance instance, EventRule rule,
236236
}
237237
catch (Exception ex)
238238
{
239-
_logger.LogError(ex, "Error executing action '{ActionType}' for rule '{RuleName}'", action.GetType().Name, rule.Name);
239+
_logger.LogError(ex, "Error executing action '{ActionType}' for rule '{RuleId}'", action.GetType().Name, rule.Id);
240240
}
241241
}
242242

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Event Rule ID Logging Implementation Plan
2+
3+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4+
5+
**Goal:** Log event rule UUIDs instead of mutable rule display names in daemon event trigger execution logs.
6+
7+
**Architecture:** Keep event trigger behavior unchanged and only adjust structured logging arguments in `EventTriggerService`. Use `EventRule.Id` for rule identity while retaining instance UUID and execution mode.
8+
9+
**Tech Stack:** C# 14, .NET 10, Microsoft.Extensions.Logging.
10+
11+
---
12+
13+
## File Structure
14+
15+
- Modify: `MCServerLauncher.Daemon/Remote/Event/EventTriggerService.cs`
16+
- Replace rule name placeholders with rule UUID placeholders for daemon event trigger logs.
17+
18+
## Task 1: Use Rule IDs In Event Trigger Logs
19+
20+
- [x] **Step 1: Locate affected logs**
21+
22+
Search `EventTriggerService` for `RuleName` and identify logs that describe rule execution/evaluation/action failures.
23+
24+
- [x] **Step 2: Replace mutable name identity**
25+
26+
Change structured log templates from `{RuleName}` to `{RuleId}` and pass `rule.Id` instead of `rule.Name`.
27+
28+
- [x] **Step 3: Verify**
29+
30+
Run:
31+
32+
```powershell
33+
dotnet build MCServerLauncher.Daemon/MCServerLauncher.Daemon.csproj /m:1 /p:OutDir=e:\MCSLCode\MCServerLauncher-Future\.artifacts\daemon-build-check\
34+
dotnet test MCServerLauncher.ProtocolTests/MCServerLauncher.ProtocolTests.csproj -c Release --no-build
35+
git diff --check
36+
```
37+
38+
Expected: commands exit 0.
39+
40+
## Changelog
41+
42+
- Updated daemon event trigger logs to identify rules by immutable UUID instead of display name.

0 commit comments

Comments
 (0)