From 024b07d5f485ad8f0a71c64bc0db578b54c002ea Mon Sep 17 00:00:00 2001 From: Maplewheels Date: Mon, 2 Feb 2026 02:59:43 -0500 Subject: [PATCH] Added logging to the EventService. --- .../SharedSource/LuaCs/Services/EventService.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/EventService.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/EventService.cs index e583b1501..c4c96d7c6 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/EventService.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/EventService.cs @@ -51,6 +51,7 @@ public partial class EventService : IEventService public static implicit operator TypeStringKey(string typeName) => new(typeName); } + private ILoggerService _loggerService; private readonly AsyncReaderWriterLock _operationsLock = new(); private readonly ConcurrentDictionary, IEvent>> _subscribers = new(); private readonly ConcurrentDictionary RunnerFactory)> _luaAliasEventFactory = new(); @@ -73,6 +74,11 @@ public partial class EventService : IEventService private int _isDisposed; + public EventService(ILoggerService loggerService) + { + _loggerService = loggerService; + } + public bool IsDisposed { get => ModUtils.Threading.GetBool(ref _isDisposed); @@ -140,6 +146,7 @@ public partial class EventService : IEventService } catch (Exception e) { + _loggerService.LogError(e.Message); #if DEBUG throw; #endif @@ -282,6 +289,7 @@ public partial class EventService : IEventService catch (Exception e) { results.WithError(new ExceptionalError(e)); + _loggerService.LogError(e.Message); #if DEBUG throw; #endif