Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add debug logging to entitywhitelist #2263

Merged
merged 4 commits into from
Nov 22, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Content.Shared/Whitelist/EntityWhitelistSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq; // DeltaV
using Content.Shared.Item;
using Content.Shared.Roles;
using Content.Shared.Tag;
Expand All @@ -11,12 +12,14 @@ public sealed class EntityWhitelistSystem : EntitySystem
[Dependency] private readonly SharedRoleSystem _roles = default!;
[Dependency] private readonly TagSystem _tag = default!;

private ISawmill _sawmill = default!; // DeltaV
MilonPL marked this conversation as resolved.
Show resolved Hide resolved
private EntityQuery<ItemComponent> _itemQuery;

public override void Initialize()
{
base.Initialize();
_itemQuery = GetEntityQuery<ItemComponent>();
_sawmill = Logger.GetSawmill("whitelist"); // DeltaV
}

/// <inheritdoc cref="IsValid(Content.Shared.Whitelist.EntityWhitelist,Robust.Shared.GameObjects.EntityUid)"/>
Expand Down Expand Up @@ -113,6 +116,20 @@ public bool IsWhitelistPass(EntityWhitelist? whitelist, EntityUid uid)
if (whitelist == null)
return false;

// Begin DeltaV
_sawmill.Debug($"Checking whitelist pass for entity {ToPrettyString(uid)}");
var isValid = IsValid(whitelist, uid);
_sawmill.Debug($"Whitelist validation result for entity {ToPrettyString(uid)}: {isValid}");

if (whitelist.RequireAll)
{
_sawmill.Debug($"Whitelist requires all conditions - Components: {string.Join(", ", whitelist.Components ?? Array.Empty<string>())}, " +
$"Tags: {(whitelist.Tags != null ? string.Join(", ", whitelist.Tags.Select(t => t.ToString())) : "none")}");
}

return isValid;
// EndDeltaV

return IsValid(whitelist, uid);
}

Expand Down
Loading