Class DebugEventMonitor
Monitors and records Scylla framework events for debugging purposes. Uses a ring buffer to maintain a fixed-size history of recent events.
Module-specific event providers register via RegisterEventProvider(Action<DebugEventMonitor, EventFilterCategory>, Action<DebugEventMonitor>) so that the monitor has no compile-time dependency on individual modules.
Inherited Members
Namespace: Scylla.Core.Editor
Assembly: ScyllaCore.Editor.dll
Syntax
public sealed class DebugEventMonitor
Constructors
DebugEventMonitor()
Creates a new DebugEventMonitor instance.
Declaration
public DebugEventMonitor()
Properties
BufferedEventCount
Gets the number of events currently in the buffer.
Declaration
public int BufferedEventCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
CurrentFilter
Gets the current event filter category.
Declaration
public EventFilterCategory CurrentFilter { get; }
Property Value
| Type | Description |
|---|---|
| EventFilterCategory |
IsPaused
Gets or sets whether event monitoring is paused. When paused, new events are not recorded.
Declaration
public bool IsPaused { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsSubscribed
Gets whether the monitor is currently subscribed to events.
Declaration
public bool IsSubscribed { get; }
Property Value
| Type | Description |
|---|---|
| bool |
TotalEventCount
Gets the total number of events captured since monitoring started.
Declaration
public int TotalEventCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
AddEvent(string, string, bool)
Manually adds an event to the monitor. Useful for testing or custom event injection.
Declaration
public void AddEvent(string eventTypeName, string description, bool isFrameworkEvent = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | eventTypeName | The event type name. |
| string | description | A description of the event. |
| bool | isFrameworkEvent | Whether this is a framework event. |
AddSubscription(ScyllaEventSubscription)
Adds a subscription to the monitor's tracked subscriptions. Called by event providers to register subscriptions that will be disposed when the monitor unsubscribes.
Declaration
public void AddSubscription(ScyllaEventSubscription subscription)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaEventSubscription | subscription | The event subscription to track. |
Clear()
Clears all recorded events and resets counters.
Declaration
public void Clear()
GetEventCountByType(string)
Gets the count of events by type name.
Declaration
public int GetEventCountByType(string eventTypeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | eventTypeName | The type name to query. |
Returns
| Type | Description |
|---|---|
| int | The count of events of that type, or 0 if none. |
GetEventsNewestFirst()
Enumerates events from newest to oldest.
Declaration
public ScyllaRingBuffer<EventLogEntry>.ReverseEnumerable GetEventsNewestFirst()
Returns
| Type | Description |
|---|---|
| ScyllaRingBuffer<EventLogEntry>.ReverseEnumerable | An enumerable of events in reverse chronological order. |
RegisterEventProvider(Action<DebugEventMonitor, EventFilterCategory>, Action<DebugEventMonitor>)
Registers an event provider that supplies event subscriptions for the monitor. Called by module-specific editor assemblies (e.g. Input.Editor) via [InitializeOnLoad] to register their event subscriptions without creating a compile-time dependency from Core.Editor to individual modules.
Declaration
public static void RegisterEventProvider(Action<DebugEventMonitor, EventFilterCategory> subscribe, Action<DebugEventMonitor> unsubscribe)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<DebugEventMonitor, EventFilterCategory> | subscribe | Delegate that subscribes the monitor to module events. Receives the monitor instance and current filter category. |
| Action<DebugEventMonitor> | unsubscribe | Delegate that unsubscribes the monitor from module events. Receives the monitor instance to clean up. |
SetFilter(EventFilterCategory)
Sets the event filter and re-subscribes to matching events. Clears existing events when filter changes.
Declaration
public void SetFilter(EventFilterCategory filter)
Parameters
| Type | Name | Description |
|---|---|---|
| EventFilterCategory | filter | The new filter category. |
Subscribe(EventFilterCategory)
Subscribes to framework events with the specified filter.
Declaration
public void Subscribe(EventFilterCategory filter = EventFilterCategory.All)
Parameters
| Type | Name | Description |
|---|---|---|
| EventFilterCategory | filter | The event filter category to subscribe to. |
Unsubscribe()
Unsubscribes from all framework events.
Declaration
public void Unsubscribe()