Implement robust logging with flexi_logger and update CI to verify logs
Some checks failed
Smoke tests / Build and smoke test (pull_request) Failing after 1m29s
Smoke tests / Build and smoke test (push) Failing after 1m30s

This commit is contained in:
AI Agent
2026-03-19 18:04:32 -06:00
parent 678543dd9a
commit 9bb4b6b69b
9 changed files with 168 additions and 130 deletions

View File

@@ -139,7 +139,7 @@ jobs:
echo "go down"
echo "go south"
echo "attack thief"
sleep 8
sleep 15
echo "stats"
echo "quit"
) | ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 2222 smoketest@localhost
@@ -170,3 +170,46 @@ jobs:
grep -q '"shop"' rpc_resp.json
rm rpc_resp.json
./target/debug/mudtool -d "$TEST_DB" players delete rpctest
- name: Verify logging
run: |
set +e
if [ ! -d "logs" ]; then
echo "Error: logs directory not found"
exit 1
fi
MS_LOG=$(ls -t logs/mudserver_*.log 2>/dev/null | head -n 1)
CB_LOG=$(ls -t logs/combat_*.log 2>/dev/null | head -n 1)
FAILED=0
if [ -z "$MS_LOG" ]; then
echo "Error: no mudserver log files found"
FAILED=1
else
echo "Checking mudserver log: $MS_LOG"
grep -q "World '.*': .* rooms" "$MS_LOG" || { echo "Failed: World loading log missing"; FAILED=1; }
grep -q "MUD server listening on" "$MS_LOG" || { echo "Failed: Listen log missing"; FAILED=1; }
grep -q "New character created: smoketest" "$MS_LOG" || { echo "Failed: smoketest creation log missing"; FAILED=1; }
grep -q "Admin action: registration setting updated: '.*'" "$MS_LOG" || { echo "Failed: Admin action log missing"; FAILED=1; }
fi
if [ -z "$CB_LOG" ]; then
echo "Error: no combat log files found"
FAILED=1
else
echo "Checking combat log: $CB_LOG"
grep -q "Combat: Player 'smoketest' (ID .*) engaged NPC 'Shadowy Thief'" "$CB_LOG" || { echo "Failed: Combat engagement log missing"; FAILED=1; }
grep -q "Combat: Player 'smoketest' (ID .*) killed NPC 'Shadowy Thief'" "$CB_LOG" || { echo "Failed: NPC kill log missing"; FAILED=1; }
fi
if [ $FAILED -ne 0 ]; then
echo "--- LOG VERIFICATION FAILED ---"
echo "--- MUDSERVER LOG CONTENTS ---"
[ -n "$MS_LOG" ] && cat "$MS_LOG"
echo "--- COMBAT LOG CONTENTS ---"
[ -n "$CB_LOG" ] && cat "$CB_LOG"
exit 1
fi
echo "Logging verification passed."