diff --git a/Content.Client/Administration/Logs/AdminLogSystem.cs b/Content.Client/Administration/Logs/AdminLogSystem.cs deleted file mode 100644 index 1a423ab01d..0000000000 --- a/Content.Client/Administration/Logs/AdminLogSystem.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Content.Shared.Administration.Logs; - -namespace Content.Client.Administration.Logs; - -public sealed class AdminLogSystem : SharedAdminLogSystem -{ -} diff --git a/Content.Client/IoC/ClientContentIoC.cs b/Content.Client/IoC/ClientContentIoC.cs index 06618dd518..148a325d83 100644 --- a/Content.Client/IoC/ClientContentIoC.cs +++ b/Content.Client/IoC/ClientContentIoC.cs @@ -18,6 +18,7 @@ using Content.Client.Stylesheets; using Content.Client.Viewport; using Content.Client.Voting; using Content.Shared.Administration; +using Content.Shared.Administration.Logs; using Content.Shared.Module; namespace Content.Client.IoC @@ -45,6 +46,7 @@ namespace Content.Client.IoC IoCManager.Register(); IoCManager.Register(); IoCManager.Register(); + IoCManager.Register(); IoCManager.Register(); IoCManager.Register(); } diff --git a/Content.IntegrationTests/Tests/Administration/Logs/AddTests.cs b/Content.IntegrationTests/Tests/Administration/Logs/AddTests.cs index 4acbdf6dcd..c2666465b8 100644 --- a/Content.IntegrationTests/Tests/Administration/Logs/AddTests.cs +++ b/Content.IntegrationTests/Tests/Administration/Logs/AddTests.cs @@ -36,7 +36,7 @@ public sealed class AddTests : ContentIntegrationTest var sMaps = server.ResolveDependency(); var sSystems = server.ResolveDependency(); - var sAdminLogSystem = sSystems.GetEntitySystem(); + var sAdminLogSystem = server.ResolveDependency(); var guid = Guid.NewGuid(); @@ -89,7 +89,7 @@ public sealed class AddTests : ContentIntegrationTest var sMaps = server.ResolveDependency(); var sSystems = server.ResolveDependency(); - var sAdminLogSystem = sSystems.GetEntitySystem(); + var sAdminLogSystem = server.ResolveDependency(); var sGamerTicker = sSystems.GetEntitySystem(); var guid = Guid.NewGuid(); @@ -156,7 +156,7 @@ public sealed class AddTests : ContentIntegrationTest var sMaps = server.ResolveDependency(); var sSystems = server.ResolveDependency(); - var sAdminLogSystem = sSystems.GetEntitySystem(); + var sAdminLogSystem = server.ResolveDependency(); await server.WaitPost(() => { @@ -193,7 +193,7 @@ public sealed class AddTests : ContentIntegrationTest var sPlayers = server.ResolveDependency(); var sSystems = server.ResolveDependency(); - var sAdminLogSystem = sSystems.GetEntitySystem(); + var sAdminLogSystem = server.ResolveDependency(); Guid playerGuid = default; await server.WaitPost(() => @@ -236,7 +236,7 @@ public sealed class AddTests : ContentIntegrationTest var sDatabase = server.ResolveDependency(); var sSystems = server.ResolveDependency(); - var sAdminLogSystem = sSystems.GetEntitySystem(); + var sAdminLogSystem = server.ResolveDependency(); var sGamerTicker = sSystems.GetEntitySystem(); var guid = Guid.NewGuid(); @@ -279,7 +279,7 @@ public sealed class AddTests : ContentIntegrationTest await foreach (var json in sDatabase.GetAdminLogsJson(filter)) { var root = json.RootElement; - + Assert.That(root.TryGetProperty("guid", out _), Is.True); json.Dispose(); @@ -302,7 +302,7 @@ public sealed class AddTests : ContentIntegrationTest var sPlayers = server.ResolveDependency(); var sSystems = server.ResolveDependency(); - var sAdminLogSystem = sSystems.GetEntitySystem(); + var sAdminLogSystem = server.ResolveDependency(); var guid = Guid.NewGuid(); @@ -347,7 +347,7 @@ public sealed class AddTests : ContentIntegrationTest var sPlayers = server.ResolveDependency(); var sSystems = server.ResolveDependency(); - var sAdminLogSystem = sSystems.GetEntitySystem(); + var sAdminLogSystem = server.ResolveDependency(); var guid = Guid.NewGuid(); diff --git a/Content.IntegrationTests/Tests/Administration/Logs/FilterTests.cs b/Content.IntegrationTests/Tests/Administration/Logs/FilterTests.cs index 538e19d54c..9ba8b57eea 100644 --- a/Content.IntegrationTests/Tests/Administration/Logs/FilterTests.cs +++ b/Content.IntegrationTests/Tests/Administration/Logs/FilterTests.cs @@ -33,7 +33,7 @@ public sealed class FilterTests : ContentIntegrationTest var sMaps = server.ResolveDependency(); var sSystems = server.ResolveDependency(); - var sAdminLogSystem = sSystems.GetEntitySystem(); + var sAdminLogSystem = server.ResolveDependency(); var commonGuid = Guid.NewGuid(); var firstGuid = Guid.NewGuid(); diff --git a/Content.IntegrationTests/Tests/Administration/Logs/QueryTests.cs b/Content.IntegrationTests/Tests/Administration/Logs/QueryTests.cs index 5e5d4a5eb7..6a686d4420 100644 --- a/Content.IntegrationTests/Tests/Administration/Logs/QueryTests.cs +++ b/Content.IntegrationTests/Tests/Administration/Logs/QueryTests.cs @@ -33,7 +33,7 @@ public sealed class QueryTests : ContentIntegrationTest var sSystems = server.ResolveDependency(); var sPlayers = server.ResolveDependency(); - var sAdminLogSystem = sSystems.GetEntitySystem(); + var sAdminLogSystem = server.ResolveDependency(); var sGamerTicker = sSystems.GetEntitySystem(); var date = DateTime.UtcNow; diff --git a/Content.Server/Administration/Commands/AdminLogBulk.cs b/Content.Server/Administration/Commands/AdminLogBulk.cs index 0132038253..78aad21a4e 100644 --- a/Content.Server/Administration/Commands/AdminLogBulk.cs +++ b/Content.Server/Administration/Commands/AdminLogBulk.cs @@ -37,7 +37,7 @@ public sealed class AdminLogBulk : IConsoleCommand return; } - var logs = EntitySystem.Get(); + var logManager = IoCManager.Resolve(); var stopwatch = new Stopwatch(); stopwatch.Start(); @@ -46,14 +46,14 @@ public sealed class AdminLogBulk : IConsoleCommand { Parallel.For(0, amount, _ => { - logs.Add(LogType.Unknown, $"Debug log added by {entity:Player}"); + logManager.Add(LogType.Unknown, $"Debug log added by {entity:Player}"); }); } else { for (var i = 0; i < amount; i++) { - logs.Add(LogType.Unknown, $"Debug log added by {entity:Player}"); + logManager.Add(LogType.Unknown, $"Debug log added by {entity:Player}"); } } diff --git a/Content.Server/Administration/Logs/AdminLogSystem.Cache.cs b/Content.Server/Administration/Logs/AdminLogManager.Cache.cs similarity index 93% rename from Content.Server/Administration/Logs/AdminLogSystem.Cache.cs rename to Content.Server/Administration/Logs/AdminLogManager.Cache.cs index 0290504211..ee7e3700a8 100644 --- a/Content.Server/Administration/Logs/AdminLogSystem.Cache.cs +++ b/Content.Server/Administration/Logs/AdminLogManager.Cache.cs @@ -7,7 +7,7 @@ using Prometheus; namespace Content.Server.Administration.Logs; -public sealed partial class AdminLogSystem +public sealed partial class AdminLogManager { private const int MaxRoundsCached = 3; private const int LogListInitialSize = 30_000; @@ -26,10 +26,10 @@ public sealed partial class AdminLogSystem "How many logs are in cache."); // TODO ADMIN LOGS cache previous {MaxRoundsCached} rounds on startup - private void CacheNewRound() + public void CacheNewRound() { List list; - var oldestRound = CurrentRoundId - MaxRoundsCached; + var oldestRound = _currentRoundId - MaxRoundsCached; if (_roundsLogCache.Remove(oldestRound, out var oldestList)) { @@ -41,7 +41,7 @@ public sealed partial class AdminLogSystem list = new List(LogListInitialSize); } - _roundsLogCache.Add(CurrentRoundId, list); + _roundsLogCache.Add(_currentRoundId, list); CacheRoundCount.Set(_roundsLogCache.Count); } @@ -61,14 +61,14 @@ public sealed partial class AdminLogSystem private void CacheLog(SharedAdminLog log) { // TODO ADMIN LOGS remove redundant data and don't do a dictionary lookup per log - var cache = _roundsLogCache[CurrentRoundId]; + var cache = _roundsLogCache[_currentRoundId]; cache.Add(log); CacheLogCount.Set(cache.Count); } private void CacheLogs(IEnumerable logs) { - var cache = _roundsLogCache[CurrentRoundId]; + var cache = _roundsLogCache[_currentRoundId]; cache.AddRange(logs); CacheLogCount.Set(cache.Count); } diff --git a/Content.Server/Administration/Logs/AdminLogSystem.Json.cs b/Content.Server/Administration/Logs/AdminLogManager.Json.cs similarity index 98% rename from Content.Server/Administration/Logs/AdminLogSystem.Json.cs rename to Content.Server/Administration/Logs/AdminLogManager.Json.cs index 7270c89854..0d14b004b6 100644 --- a/Content.Server/Administration/Logs/AdminLogSystem.Json.cs +++ b/Content.Server/Administration/Logs/AdminLogManager.Json.cs @@ -7,7 +7,7 @@ using Robust.Server.Player; namespace Content.Server.Administration.Logs; -public sealed partial class AdminLogSystem +public sealed partial class AdminLogManager { private static readonly JsonNamingPolicy NamingPolicy = JsonNamingPolicy.CamelCase; diff --git a/Content.Server/Administration/Logs/AdminLogManager.cs b/Content.Server/Administration/Logs/AdminLogManager.cs new file mode 100644 index 0000000000..0b0625bba2 --- /dev/null +++ b/Content.Server/Administration/Logs/AdminLogManager.cs @@ -0,0 +1,360 @@ +using System.Collections.Concurrent; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Content.Server.Database; +using Content.Server.GameTicking; +using Content.Shared.Administration.Logs; +using Content.Shared.CCVar; +using Content.Shared.Database; +using Prometheus; +using Robust.Shared; +using Robust.Shared.Configuration; +using Robust.Shared.Reflection; +using Robust.Shared.Timing; + +namespace Content.Server.Administration.Logs; + +public sealed partial class AdminLogManager : SharedAdminLogManager, IAdminLogManager +{ + [Dependency] private readonly IConfigurationManager _configuration = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; + [Dependency] private readonly ILogManager _logManager = default!; + [Dependency] private readonly IServerDbManager _db = default!; + [Dependency] private readonly IGameTiming _timing = default!; + [Dependency] private readonly IDynamicTypeFactory _typeFactory = default!; + [Dependency] private readonly IReflectionManager _reflection = default!; + + public const string SawmillId = "admin.logs"; + + private static readonly Histogram DatabaseUpdateTime = Metrics.CreateHistogram( + "admin_logs_database_time", + "Time used to send logs to the database in ms", + new HistogramConfiguration + { + Buckets = Histogram.LinearBuckets(0, 0.5, 20) + }); + + private static readonly Gauge Queue = Metrics.CreateGauge( + "admin_logs_queue", + "How many logs are in the queue."); + + private static readonly Gauge PreRoundQueue = Metrics.CreateGauge( + "admin_logs_pre_round_queue", + "How many logs are in the pre-round queue."); + + private static readonly Gauge QueueCapReached = Metrics.CreateGauge( + "admin_logs_queue_cap_reached", + "Number of times the log queue cap has been reached in a round."); + + private static readonly Gauge PreRoundQueueCapReached = Metrics.CreateGauge( + "admin_logs_queue_cap_reached", + "Number of times the pre-round log queue cap has been reached in a round."); + + private static readonly Gauge LogsSent = Metrics.CreateGauge( + "admin_logs_sent", + "Amount of logs sent to the database in a round."); + + // Init only + private ISawmill _sawmill = default!; + + // CVars + private bool _metricsEnabled; + private bool _enabled; + private TimeSpan _queueSendDelay; + private int _queueMax; + private int _preRoundQueueMax; + + // Per update + private TimeSpan _nextUpdateTime; + private readonly ConcurrentQueue _logQueue = new(); + private readonly ConcurrentQueue _preRoundLogQueue = new(); + + // Per round + private int _currentRoundId; + private int _currentLogId; + private int NextLogId => Interlocked.Increment(ref _currentLogId); + private GameRunLevel _runLevel = GameRunLevel.PreRoundLobby; + + public void Initialize() + { + _sawmill = _logManager.GetSawmill(SawmillId); + + InitializeJson(); + + _configuration.OnValueChanged(CVars.MetricsEnabled, + value => _metricsEnabled = value, true); + _configuration.OnValueChanged(CCVars.AdminLogsEnabled, + value => _enabled = value, true); + _configuration.OnValueChanged(CCVars.AdminLogsQueueSendDelay, + value => _queueSendDelay = TimeSpan.FromSeconds(value), true); + _configuration.OnValueChanged(CCVars.AdminLogsQueueMax, + value => _queueMax = value, true); + _configuration.OnValueChanged(CCVars.AdminLogsPreRoundQueueMax, + value => _preRoundQueueMax = value, true); + + if (_metricsEnabled) + { + PreRoundQueueCapReached.Set(0); + QueueCapReached.Set(0); + LogsSent.Set(0); + } + } + + public async Task Shutdown() + { + if (!_logQueue.IsEmpty) + { + await SaveLogs(); + } + } + + public async void Update() + { + if (_runLevel == GameRunLevel.PreRoundLobby) + { + await PreRoundUpdate(); + return; + } + + var count = _logQueue.Count; + Queue.Set(count); + + var preRoundCount = _preRoundLogQueue.Count; + PreRoundQueue.Set(preRoundCount); + + if (count + preRoundCount == 0) + { + return; + } + + if (_timing.RealTime >= _nextUpdateTime) + { + await SaveLogs(); + return; + } + + if (count >= _queueMax) + { + if (_metricsEnabled) + { + QueueCapReached.Inc(); + } + + _sawmill.Warning($"Maximum cap of {_queueMax} reached for admin logs."); + await SaveLogs(); + } + } + + private async Task PreRoundUpdate() + { + var preRoundCount = _preRoundLogQueue.Count; + PreRoundQueue.Set(preRoundCount); + + if (preRoundCount < _preRoundQueueMax) + { + return; + } + + if (_metricsEnabled) + { + PreRoundQueueCapReached.Inc(); + } + + _sawmill.Warning($"Maximum cap of {_preRoundQueueMax} reached for pre-round admin logs."); + await SaveLogs(); + } + + private async Task SaveLogs() + { + _nextUpdateTime = _timing.RealTime.Add(_queueSendDelay); + + // TODO ADMIN LOGS array pool + var copy = new List(_logQueue.Count + _preRoundLogQueue.Count); + + copy.AddRange(_logQueue); + _logQueue.Clear(); + Queue.Set(0); + + if (_runLevel == GameRunLevel.PreRoundLobby && !_preRoundLogQueue.IsEmpty) + { + _sawmill.Error($"Dropping {_preRoundLogQueue.Count} pre-round logs. Current cap: {_preRoundQueueMax}"); + } + else + { + foreach (var queued in _preRoundLogQueue) + { + queued.Log.RoundId = _currentRoundId; + CacheLog(queued); + } + + copy.AddRange(_preRoundLogQueue); + } + + _preRoundLogQueue.Clear(); + PreRoundQueue.Set(0); + + // ship the logs to Azkaban + var task = Task.Run(async () => + { + await _db.AddAdminLogs(copy); + }); + + _sawmill.Debug($"Saving {copy.Count} admin logs."); + + if (_metricsEnabled) + { + LogsSent.Inc(copy.Count); + + using (DatabaseUpdateTime.NewTimer()) + { + await task; + return; + } + } + + await task; + } + + public void RoundStarting(int id) + { + _currentRoundId = id; + CacheNewRound(); + } + + public void RunLevelChanged(GameRunLevel level) + { + _runLevel = level; + + if (level == GameRunLevel.PreRoundLobby) + { + Interlocked.Exchange(ref _currentLogId, 0); + + if (_metricsEnabled) + { + PreRoundQueueCapReached.Set(0); + QueueCapReached.Set(0); + LogsSent.Set(0); + } + } + } + + private async void Add(LogType type, LogImpact impact, string message, JsonDocument json, HashSet players, Dictionary entities) + { + var logId = NextLogId; + var date = DateTime.UtcNow; + + var log = new AdminLog + { + Id = logId, + RoundId = _currentRoundId, + Type = type, + Impact = impact, + Date = date, + Message = message, + Json = json, + Players = new List(players.Count) + }; + + var queued = new QueuedLog(log, entities); + + foreach (var id in players) + { + var player = new AdminLogPlayer + { + LogId = logId, + PlayerUserId = id + }; + + log.Players.Add(player); + } + + if (_runLevel == GameRunLevel.PreRoundLobby) + { + _preRoundLogQueue.Enqueue(queued); + } + else + { + _logQueue.Enqueue(queued); + CacheLog(log); + } + } + + public override void Add(LogType type, LogImpact impact, ref LogStringHandler handler) + { + if (!_enabled) + { + handler.ToStringAndClear(); + return; + } + + var (json, players, entities) = ToJson(handler.Values); + var message = handler.ToStringAndClear(); + + Add(type, impact, message, json, players, entities); + } + + public override void Add(LogType type, ref LogStringHandler handler) + { + Add(type, LogImpact.Medium, ref handler); + } + + public async Task> All(LogFilter? filter = null) + { + if (TrySearchCache(filter, out var results)) + { + return results; + } + + var initialSize = Math.Min(filter?.Limit ?? 0, 1000); + var list = new List(initialSize); + + await foreach (var log in _db.GetAdminLogs(filter).WithCancellation(filter?.CancellationToken ?? default)) + { + list.Add(log); + } + + return list; + } + + public IAsyncEnumerable AllMessages(LogFilter? filter = null) + { + return _db.GetAdminLogMessages(filter); + } + + public IAsyncEnumerable AllJson(LogFilter? filter = null) + { + return _db.GetAdminLogsJson(filter); + } + + public Task Round(int roundId) + { + return _db.GetRound(roundId); + } + + public Task> CurrentRoundLogs(LogFilter? filter = null) + { + filter ??= new LogFilter(); + filter.Round = _currentRoundId; + return All(filter); + } + + public IAsyncEnumerable CurrentRoundMessages(LogFilter? filter = null) + { + filter ??= new LogFilter(); + filter.Round = _currentRoundId; + return AllMessages(filter); + } + + public IAsyncEnumerable CurrentRoundJson(LogFilter? filter = null) + { + filter ??= new LogFilter(); + filter.Round = _currentRoundId; + return AllJson(filter); + } + + public Task CurrentRound() + { + return Round(_currentRoundId); + } +} diff --git a/Content.Server/Administration/Logs/AdminLogSystem.cs b/Content.Server/Administration/Logs/AdminLogSystem.cs index f7daac1fcb..cf5da2322f 100644 --- a/Content.Server/Administration/Logs/AdminLogSystem.cs +++ b/Content.Server/Administration/Logs/AdminLogSystem.cs @@ -1,367 +1,31 @@ -using System.Collections.Concurrent; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Content.Server.Database; -using Content.Server.GameTicking; +using Content.Server.GameTicking; using Content.Server.GameTicking.Events; -using Content.Shared.Administration.Logs; -using Content.Shared.CCVar; -using Content.Shared.Database; -using Prometheus; -using Robust.Shared; -using Robust.Shared.Configuration; -using Robust.Shared.Reflection; namespace Content.Server.Administration.Logs; -public sealed partial class AdminLogSystem : SharedAdminLogSystem +/// +/// For system events that the manager needs to know about. +/// for admin log usage. +/// +public sealed class AdminLogSystem : EntitySystem { - [Dependency] private readonly IConfigurationManager _configuration = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; - [Dependency] private readonly ILogManager _logManager = default!; - [Dependency] private readonly IServerDbManager _db = default!; - [Dependency] private readonly IDynamicTypeFactory _typeFactory = default!; - [Dependency] private readonly IReflectionManager _reflection = default!; - - [Dependency] private readonly GameTicker _gameTicker = default!; - - public const string SawmillId = "admin.logs"; - - private static readonly Histogram DatabaseUpdateTime = Metrics.CreateHistogram( - "admin_logs_database_time", - "Time used to send logs to the database in ms", - new HistogramConfiguration - { - Buckets = Histogram.LinearBuckets(0, 0.5, 20) - }); - - private static readonly Gauge Queue = Metrics.CreateGauge( - "admin_logs_queue", - "How many logs are in the queue."); - - private static readonly Gauge PreRoundQueue = Metrics.CreateGauge( - "admin_logs_pre_round_queue", - "How many logs are in the pre-round queue."); - - private static readonly Gauge QueueCapReached = Metrics.CreateGauge( - "admin_logs_queue_cap_reached", - "Number of times the log queue cap has been reached in a round."); - - private static readonly Gauge PreRoundQueueCapReached = Metrics.CreateGauge( - "admin_logs_queue_cap_reached", - "Number of times the pre-round log queue cap has been reached in a round."); - - private static readonly Gauge LogsSent = Metrics.CreateGauge( - "admin_logs_sent", - "Amount of logs sent to the database in a round."); - - // Init only - private ISawmill _sawmill = default!; - - // CVars - private bool _metricsEnabled; - private bool _enabled; - private TimeSpan _queueSendDelay; - private int _queueMax; - private int _preRoundQueueMax; - - // Per update - private float _accumulatedFrameTime; - private readonly ConcurrentQueue _logQueue = new(); - private readonly ConcurrentQueue _preRoundLogQueue = new(); - - // Per round - private int CurrentRoundId => _gameTicker.RoundId; - private int _currentLogId; - private int NextLogId => Interlocked.Increment(ref _currentLogId); + [Dependency] private readonly IAdminLogManager _adminLogs = default!; public override void Initialize() { base.Initialize(); - _sawmill = _logManager.GetSawmill(SawmillId); - - InitializeJson(); - - _configuration.OnValueChanged(CVars.MetricsEnabled, - value => _metricsEnabled = value, true); - _configuration.OnValueChanged(CCVars.AdminLogsEnabled, - value => _enabled = value, true); - _configuration.OnValueChanged(CCVars.AdminLogsQueueSendDelay, - value => _queueSendDelay = TimeSpan.FromSeconds(value), true); - _configuration.OnValueChanged(CCVars.AdminLogsQueueMax, - value => _queueMax = value, true); - _configuration.OnValueChanged(CCVars.AdminLogsPreRoundQueueMax, - value => _preRoundQueueMax = value, true); - - if (_metricsEnabled) - { - PreRoundQueueCapReached.Set(0); - QueueCapReached.Set(0); - LogsSent.Set(0); - } - - SubscribeLocalEvent(RoundStarting); - SubscribeLocalEvent(RunLevelChanged); + SubscribeLocalEvent(ev => _adminLogs.RoundStarting(ev.Id)); + SubscribeLocalEvent(ev => _adminLogs.RunLevelChanged(ev.New)); } - public override async void Shutdown() + public override void Update(float frameTime) { - base.Shutdown(); - - if (!_logQueue.IsEmpty) - { - await SaveLogs(); - } + _adminLogs.Update(); } - public override async void Update(float frameTime) + public override void Shutdown() { - if (_gameTicker.RunLevel == GameRunLevel.PreRoundLobby) - { - await PreRoundUpdate(); - return; - } - - var count = _logQueue.Count; - Queue.Set(count); - - var preRoundCount = _preRoundLogQueue.Count; - PreRoundQueue.Set(preRoundCount); - - if (count + preRoundCount == 0) - { - return; - } - - if (_accumulatedFrameTime >= _queueSendDelay.TotalSeconds) - { - await SaveLogs(); - return; - } - - if (count >= _queueMax) - { - if (_metricsEnabled) - { - QueueCapReached.Inc(); - } - - _sawmill.Warning($"Maximum cap of {_queueMax} reached for admin logs."); - await SaveLogs(); - return; - } - - _accumulatedFrameTime += frameTime; - } - - private async Task PreRoundUpdate() - { - var preRoundCount = _preRoundLogQueue.Count; - PreRoundQueue.Set(preRoundCount); - - if (preRoundCount < _preRoundQueueMax) - { - return; - } - - if (_metricsEnabled) - { - PreRoundQueueCapReached.Inc(); - } - - _sawmill.Warning($"Maximum cap of {_preRoundQueueMax} reached for pre-round admin logs."); - await SaveLogs(); - } - - private async Task SaveLogs() - { - _accumulatedFrameTime = 0f; - - // TODO ADMIN LOGS array pool - var copy = new List(_logQueue.Count + _preRoundLogQueue.Count); - - copy.AddRange(_logQueue); - _logQueue.Clear(); - Queue.Set(0); - - if (_gameTicker.RunLevel == GameRunLevel.PreRoundLobby) - { - _sawmill.Error($"Dropping {_preRoundLogQueue.Count} pre-round logs. Current cap: {_preRoundQueueMax}"); - } - else - { - foreach (var queued in _preRoundLogQueue) - { - queued.Log.RoundId = _gameTicker.RoundId; - CacheLog(queued); - } - - copy.AddRange(_preRoundLogQueue); - } - - _preRoundLogQueue.Clear(); - PreRoundQueue.Set(0); - - // ship the logs to Azkaban - var task = Task.Run(async () => - { - await _db.AddAdminLogs(copy); - }); - - _sawmill.Debug($"Saving {copy.Count} admin logs."); - - if (_metricsEnabled) - { - LogsSent.Inc(copy.Count); - - using (DatabaseUpdateTime.NewTimer()) - { - await task; - return; - } - } - - await task; - } - - private void RoundStarting(RoundStartingEvent ev) - { - CacheNewRound(); - } - - private void RunLevelChanged(GameRunLevelChangedEvent ev) - { - if (ev.New == GameRunLevel.PreRoundLobby) - { - Interlocked.Exchange(ref _currentLogId, 0); - - if (_metricsEnabled) - { - PreRoundQueueCapReached.Set(0); - QueueCapReached.Set(0); - LogsSent.Set(0); - } - } - } - - private async void Add(LogType type, LogImpact impact, string message, JsonDocument json, HashSet players, Dictionary entities) - { - var logId = NextLogId; - var date = DateTime.UtcNow; - - var log = new AdminLog - { - Id = logId, - RoundId = CurrentRoundId, - Type = type, - Impact = impact, - Date = date, - Message = message, - Json = json, - Players = new List(players.Count) - }; - - var queued = new QueuedLog(log, entities); - - foreach (var id in players) - { - var player = new AdminLogPlayer - { - LogId = logId, - PlayerUserId = id - }; - - log.Players.Add(player); - } - - if (_gameTicker.RunLevel == GameRunLevel.PreRoundLobby) - { - _preRoundLogQueue.Enqueue(queued); - } - else - { - _logQueue.Enqueue(queued); - CacheLog(log); - } - } - - public override void Add(LogType type, LogImpact impact, ref LogStringHandler handler) - { - if (!_enabled) - { - handler.ToStringAndClear(); - return; - } - - var (json, players, entities) = ToJson(handler.Values); - var message = handler.ToStringAndClear(); - - Add(type, impact, message, json, players, entities); - } - - public override void Add(LogType type, ref LogStringHandler handler) - { - Add(type, LogImpact.Medium, ref handler); - } - - public async Task> All(LogFilter? filter = null) - { - if (TrySearchCache(filter, out var results)) - { - return results; - } - - var initialSize = Math.Min(filter?.Limit ?? 0, 1000); - var list = new List(initialSize); - - await foreach (var log in _db.GetAdminLogs(filter).WithCancellation(filter?.CancellationToken ?? default)) - { - list.Add(log); - } - - return list; - } - - public IAsyncEnumerable AllMessages(LogFilter? filter = null) - { - return _db.GetAdminLogMessages(filter); - } - - public IAsyncEnumerable AllJson(LogFilter? filter = null) - { - return _db.GetAdminLogsJson(filter); - } - - public Task Round(int roundId) - { - return _db.GetRound(roundId); - } - - public Task> CurrentRoundLogs(LogFilter? filter = null) - { - filter ??= new LogFilter(); - filter.Round = CurrentRoundId; - return All(filter); - } - - public IAsyncEnumerable CurrentRoundMessages(LogFilter? filter = null) - { - filter ??= new LogFilter(); - filter.Round = CurrentRoundId; - return AllMessages(filter); - } - - public IAsyncEnumerable CurrentRoundJson(LogFilter? filter = null) - { - filter ??= new LogFilter(); - filter.Round = CurrentRoundId; - return AllJson(filter); - } - - public Task CurrentRound() - { - return Round(CurrentRoundId); + _adminLogs.Shutdown(); } } diff --git a/Content.Server/Administration/Logs/AdminLogsEui.cs b/Content.Server/Administration/Logs/AdminLogsEui.cs index 9255086aca..ba89ab35fd 100644 --- a/Content.Server/Administration/Logs/AdminLogsEui.cs +++ b/Content.Server/Administration/Logs/AdminLogsEui.cs @@ -16,12 +16,12 @@ namespace Content.Server.Administration.Logs; public sealed class AdminLogsEui : BaseEui { + [Dependency] private readonly IAdminLogManager _adminLogs = default!; [Dependency] private readonly IAdminManager _adminManager = default!; [Dependency] private readonly ILogManager _logManager = default!; [Dependency] private readonly IConfigurationManager _configuration = default!; private readonly ISawmill _sawmill; - private readonly AdminLogSystem _logSystem; private int _clientBatchSize; private bool _isLoading = true; @@ -33,12 +33,10 @@ public sealed class AdminLogsEui : BaseEui { IoCManager.InjectDependencies(this); - _sawmill = _logManager.GetSawmill(AdminLogSystem.SawmillId); + _sawmill = _logManager.GetSawmill(AdminLogManager.SawmillId); _configuration.OnValueChanged(CCVars.AdminLogsClientBatchSize, ClientBatchSizeChanged, true); - _logSystem = EntitySystem.Get(); - _filter = new LogFilter { CancellationToken = _logSendCancellation.Token, @@ -146,7 +144,7 @@ public sealed class AdminLogsEui : BaseEui await Task.Run(async () => { - logs = await _logSystem.All(_filter); + logs = await _adminLogs.All(_filter); }, _filter.CancellationToken); if (logs.Count > 0) @@ -186,7 +184,7 @@ public sealed class AdminLogsEui : BaseEui _isLoading = true; StateDirty(); - var round = await Task.Run(() => _logSystem.Round(roundId)); + var round = await Task.Run(() => _adminLogs.Round(roundId)); var players = round.Players .ToDictionary(player => player.UserId, player => player.LastSeenUserName); diff --git a/Content.Server/Administration/Logs/IAdminLogManager.cs b/Content.Server/Administration/Logs/IAdminLogManager.cs new file mode 100644 index 0000000000..47a4da6f57 --- /dev/null +++ b/Content.Server/Administration/Logs/IAdminLogManager.cs @@ -0,0 +1,26 @@ +using System.Text.Json; +using System.Threading.Tasks; +using Content.Server.Database; +using Content.Server.GameTicking; +using Content.Shared.Administration.Logs; + +namespace Content.Server.Administration.Logs; + +public interface IAdminLogManager : ISharedAdminLogManager +{ + void Initialize(); + Task Shutdown(); + void Update(); + + void RoundStarting(int id); + void RunLevelChanged(GameRunLevel level); + + Task> All(LogFilter? filter = null); + IAsyncEnumerable AllMessages(LogFilter? filter = null); + IAsyncEnumerable AllJson(LogFilter? filter = null); + Task Round(int roundId); + Task> CurrentRoundLogs(LogFilter? filter = null); + IAsyncEnumerable CurrentRoundMessages(LogFilter? filter = null); + IAsyncEnumerable CurrentRoundJson(LogFilter? filter = null); + Task CurrentRound(); +} diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs index 3d34b3b7af..fd00628ab5 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs @@ -479,7 +479,7 @@ namespace Content.Server.Atmos.EntitySystems } if(tileCount > 10 && (totalMolesRemoved / tileCount) > 20) - _adminLog.Add(LogType.ExplosiveDepressurization, LogImpact.High, + _adminLogger.Add(LogType.ExplosiveDepressurization, LogImpact.High, $"Explosive depressurization removed {totalMolesRemoved} moles from {tileCount} tiles starting from position {tile.GridIndices:position} on grid ID {tile.GridIndex:grid}"); Array.Clear(_depressurizeTiles, 0, Atmospherics.MonstermosHardTileLimit); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs index db35873d64..5babbd230f 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs @@ -16,7 +16,7 @@ namespace Content.Server.Atmos.EntitySystems public sealed partial class AtmosphereSystem : SharedAtmosphereSystem { [Dependency] private readonly IMapManager _mapManager = default!; - [Dependency] private readonly AdminLogSystem _adminLog = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedContainerSystem _containers = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; diff --git a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs index 93a61cc04f..556615fb0a 100644 --- a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs +++ b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs @@ -15,7 +15,7 @@ namespace Content.Server.Atmos.EntitySystems [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly AlertsSystem _alertsSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; [Dependency] private readonly InventorySystem _inventorySystem = default!; private const float UpdateTimer = 1f; @@ -172,7 +172,7 @@ namespace Content.Server.Atmos.EntitySystems if (!barotrauma.TakingDamage) { barotrauma.TakingDamage = true; - _logSystem.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} started taking low pressure damage"); + _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} started taking low pressure damage"); } if (pressure <= Atmospherics.HazardLowPressure) @@ -199,7 +199,7 @@ namespace Content.Server.Atmos.EntitySystems if (!barotrauma.TakingDamage) { barotrauma.TakingDamage = true; - _logSystem.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} started taking high pressure damage"); + _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} started taking high pressure damage"); } if (pressure >= Atmospherics.HazardHighPressure) @@ -216,7 +216,7 @@ namespace Content.Server.Atmos.EntitySystems if (barotrauma.TakingDamage) { barotrauma.TakingDamage = false; - _logSystem.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} stopped taking pressure damage"); + _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} stopped taking pressure damage"); } _alertsSystem.ClearAlertCategory(barotrauma.Owner, AlertCategory.Pressure); break; diff --git a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs index a7b6410867..458f8e9062 100644 --- a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs +++ b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs @@ -24,7 +24,7 @@ namespace Content.Server.Atmos.EntitySystems [Dependency] private readonly TemperatureSystem _temperatureSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly AlertsSystem _alertsSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; private const float MinimumFireStacks = -10f; private const float MaximumFireStacks = 20f; @@ -151,7 +151,7 @@ namespace Content.Server.Atmos.EntitySystems if (!flammable.OnFire) return; - _logSystem.Add(LogType.Flammable, $"{ToPrettyString(flammable.Owner):entity} stopped being on fire damage"); + _adminLogger.Add(LogType.Flammable, $"{ToPrettyString(flammable.Owner):entity} stopped being on fire damage"); flammable.OnFire = false; flammable.FireStacks = 0; @@ -167,7 +167,7 @@ namespace Content.Server.Atmos.EntitySystems if (flammable.FireStacks > 0 && !flammable.OnFire) { - _logSystem.Add(LogType.Flammable, $"{ToPrettyString(flammable.Owner):entity} is on fire"); + _adminLogger.Add(LogType.Flammable, $"{ToPrettyString(flammable.Owner):entity} is on fire"); flammable.OnFire = true; } @@ -243,7 +243,7 @@ namespace Content.Server.Atmos.EntitySystems { // TODO FLAMMABLE: further balancing var damageScale = Math.Min((int)flammable.FireStacks, 5); - + if(TryComp(uid, out TemperatureComponent? temp)) _temperatureSystem.ChangeHeat(uid, 12500 * damageScale, false, temp); diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs index c2714585d7..c71d9be64d 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs @@ -21,7 +21,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems public sealed class GasPressurePumpSystem : EntitySystem { [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; - [Dependency] private readonly AdminLogSystem _adminLogSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; @@ -116,7 +116,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnToggleStatusMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpToggleStatusMessage args) { pump.Enabled = args.Enabled; - _adminLogSystem.Add(LogType.AtmosPowerChanged, LogImpact.Medium, + _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); DirtyUI(uid, pump); } @@ -124,7 +124,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnOutputPressureChangeMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpChangeOutputPressureMessage args) { pump.TargetPressure = Math.Clamp(args.Pressure, 0f, Atmospherics.MaxOutputPressure); - _adminLogSystem.Add(LogType.AtmosPressureChanged, LogImpact.Medium, + _adminLogger.Add(LogType.AtmosPressureChanged, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa"); DirtyUI(uid, pump); diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs index daead286ca..71061b98a7 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs @@ -23,7 +23,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; - [Dependency] private readonly AdminLogSystem _adminLogSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; public override void Initialize() @@ -121,7 +121,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnToggleStatusMessage(EntityUid uid, GasVolumePumpComponent pump, GasVolumePumpToggleStatusMessage args) { pump.Enabled = args.Enabled; - _adminLogSystem.Add(LogType.AtmosPowerChanged, LogImpact.Medium, + _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); DirtyUI(uid, pump); } @@ -129,7 +129,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnTransferRateChangeMessage(EntityUid uid, GasVolumePumpComponent pump, GasVolumePumpChangeTransferRateMessage args) { pump.TransferRate = Math.Clamp(args.TransferRate, 0f, pump.MaxTransferRate); - _adminLogSystem.Add(LogType.AtmosVolumeChanged, LogImpact.Medium, + _adminLogger.Add(LogType.AtmosVolumeChanged, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the transfer rate on {ToPrettyString(uid):device} to {args.TransferRate}"); DirtyUI(uid, pump); } diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs index 8ac301fe22..52d55515e1 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs @@ -22,7 +22,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems { [Dependency] private IGameTiming _gameTiming = default!; [Dependency] private UserInterfaceSystem _userInterfaceSystem = default!; - [Dependency] private AdminLogSystem _adminLogSystem = default!; + [Dependency] private IAdminLogManager _adminLogger = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; @@ -140,7 +140,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems private void OnToggleStatusMessage(EntityUid uid, GasFilterComponent filter, GasFilterToggleStatusMessage args) { filter.Enabled = args.Enabled; - _adminLogSystem.Add(LogType.AtmosPowerChanged, LogImpact.Medium, + _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); DirtyUI(uid, filter); @@ -149,7 +149,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems private void OnTransferRateChangeMessage(EntityUid uid, GasFilterComponent filter, GasFilterChangeRateMessage args) { filter.TransferRate = Math.Clamp(args.Rate, 0f, filter.MaxTransferRate); - _adminLogSystem.Add(LogType.AtmosVolumeChanged, LogImpact.Medium, + _adminLogger.Add(LogType.AtmosVolumeChanged, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the transfer rate on {ToPrettyString(uid):device} to {args.Rate}"); DirtyUI(uid, filter); diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs index 4bc275343a..152f11f994 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs @@ -20,7 +20,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems public sealed class GasMixerSystem : EntitySystem { [Dependency] private UserInterfaceSystem _userInterfaceSystem = default!; - [Dependency] private AdminLogSystem _adminLogSystem = default!; + [Dependency] private IAdminLogManager _adminLogger = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; @@ -180,7 +180,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems private void OnToggleStatusMessage(EntityUid uid, GasMixerComponent mixer, GasMixerToggleStatusMessage args) { mixer.Enabled = args.Enabled; - _adminLogSystem.Add(LogType.AtmosPowerChanged, LogImpact.Medium, + _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); DirtyUI(uid, mixer); UpdateAppearance(uid, mixer); @@ -189,7 +189,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems private void OnOutputPressureChangeMessage(EntityUid uid, GasMixerComponent mixer, GasMixerChangeOutputPressureMessage args) { mixer.TargetPressure = Math.Clamp(args.Pressure, 0f, mixer.MaxTargetPressure); - _adminLogSystem.Add(LogType.AtmosPressureChanged, LogImpact.Medium, + _adminLogger.Add(LogType.AtmosPressureChanged, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa"); DirtyUI(uid, mixer); } @@ -200,7 +200,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems float nodeOne = Math.Clamp(args.NodeOne, 0f, 100.0f) / 100.0f; mixer.InletOneConcentration = nodeOne; mixer.InletTwoConcentration = 1.0f - mixer.InletOneConcentration; - _adminLogSystem.Add(LogType.AtmosRatioChanged, LogImpact.Medium, + _adminLogger.Add(LogType.AtmosRatioChanged, LogImpact.Medium, $"{EntityManager.ToPrettyString(args.Session.AttachedEntity!.Value):player} set the ratio on {EntityManager.ToPrettyString(uid):device} to {mixer.InletOneConcentration}:{mixer.InletTwoConcentration}"); DirtyUI(uid, mixer); } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs index 4a0397f334..a36528f996 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs @@ -22,7 +22,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems { [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; - [Dependency] private readonly AdminLogSystem _adminLogSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; public override void Initialize() @@ -56,7 +56,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (environment is not null) _atmosphereSystem.Merge(environment, canister.Air); - _adminLogSystem.Add(LogType.CanisterPurged, LogImpact.Medium, $"Canister {ToPrettyString(uid):canister} purged its contents of {canister.Air:gas} into the environment."); + _adminLogger.Add(LogType.CanisterPurged, LogImpact.Medium, $"Canister {ToPrettyString(uid):canister} purged its contents of {canister.Air:gas} into the environment."); canister.Air.Clear(); } @@ -110,7 +110,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (container.ContainedEntities.Count == 0) return; - _adminLogSystem.Add(LogType.CanisterTankEjected, LogImpact.Medium, $"Player {ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} ejected tank {ToPrettyString(container.ContainedEntities[0]):tank} from {ToPrettyString(uid):canister}"); + _adminLogger.Add(LogType.CanisterTankEjected, LogImpact.Medium, $"Player {ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} ejected tank {ToPrettyString(container.ContainedEntities[0]):tank} from {ToPrettyString(uid):canister}"); container.Remove(container.ContainedEntities[0]); } @@ -118,7 +118,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems { var pressure = Math.Clamp(args.Pressure, canister.MinReleasePressure, canister.MaxReleasePressure); - _adminLogSystem.Add(LogType.CanisterPressure, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} set the release pressure on {ToPrettyString(uid):canister} to {args.Pressure}"); + _adminLogger.Add(LogType.CanisterPressure, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} set the release pressure on {ToPrettyString(uid):canister} to {args.Pressure}"); canister.ReleasePressure = pressure; DirtyUI(uid, canister); @@ -131,7 +131,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems && containerManager.TryGetContainer(canister.ContainerName, out var container)) impact = container.ContainedEntities.Count != 0 ? LogImpact.Medium : LogImpact.High; - _adminLogSystem.Add(LogType.CanisterValve, impact, $"{ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} set the valve on {ToPrettyString(uid):canister} to {args.Valve:valveState}"); + _adminLogger.Add(LogType.CanisterValve, impact, $"{ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} set the valve on {ToPrettyString(uid):canister} to {args.Valve:valveState}"); canister.ReleaseValve = args.Valve; DirtyUI(uid, canister); @@ -245,7 +245,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (!_handsSystem.TryDropIntoContainer(args.User, args.Used, container)) return; - _adminLogSystem.Add(LogType.CanisterTankInserted, LogImpact.Medium, $"Player {ToPrettyString(args.User):player} inserted tank {ToPrettyString(container.ContainedEntities[0]):tank} into {ToPrettyString(canister):canister}"); + _adminLogger.Add(LogType.CanisterTankInserted, LogImpact.Medium, $"Player {ToPrettyString(args.User):player} inserted tank {ToPrettyString(container.ContainedEntities[0]):tank} into {ToPrettyString(canister):canister}"); args.Handled = true; } diff --git a/Content.Server/Body/Systems/MetabolizerSystem.cs b/Content.Server/Body/Systems/MetabolizerSystem.cs index b3d5a23764..53b4bede29 100644 --- a/Content.Server/Body/Systems/MetabolizerSystem.cs +++ b/Content.Server/Body/Systems/MetabolizerSystem.cs @@ -21,7 +21,7 @@ namespace Content.Server.Body.Systems [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly SharedAdminLogSystem _logSystem = default!; + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; public override void Initialize() { @@ -182,7 +182,7 @@ namespace Content.Server.Body.Systems if (effect.ShouldLog) { - _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, + _adminLogger.Add(LogType.ReagentEffect, effect.LogImpact, $"Metabolism effect {effect.GetType().Name:effect} of reagent {args.Reagent.LocalizedName:reagent} applied on entity {actualEntity:entity} at {Transform(actualEntity).Coordinates:coordinates}"); } diff --git a/Content.Server/Body/Systems/RespiratorSystem.cs b/Content.Server/Body/Systems/RespiratorSystem.cs index bcc5dffa65..1e6ddd88be 100644 --- a/Content.Server/Body/Systems/RespiratorSystem.cs +++ b/Content.Server/Body/Systems/RespiratorSystem.cs @@ -19,7 +19,7 @@ namespace Content.Server.Body.Systems public sealed class RespiratorSystem : EntitySystem { [Dependency] private readonly DamageableSystem _damageableSys = default!; - [Dependency] private readonly AdminLogSystem _logSys = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly BodySystem _bodySystem = default!; [Dependency] private readonly LungSystem _lungSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosSys = default!; @@ -154,7 +154,7 @@ namespace Content.Server.Body.Systems private void TakeSuffocationDamage(EntityUid uid, RespiratorComponent respirator) { if (respirator.SuffocationCycles == 2) - _logSys.Add(LogType.Asphyxiation, $"{ToPrettyString(uid):entity} started suffocating"); + _adminLogger.Add(LogType.Asphyxiation, $"{ToPrettyString(uid):entity} started suffocating"); if (respirator.SuffocationCycles >= respirator.SuffocationCycleThreshold) { @@ -167,7 +167,7 @@ namespace Content.Server.Body.Systems private void StopSuffocation(EntityUid uid, RespiratorComponent respirator) { if (respirator.SuffocationCycles >= 2) - _logSys.Add(LogType.Asphyxiation, $"{ToPrettyString(uid):entity} stopped suffocating"); + _adminLogger.Add(LogType.Asphyxiation, $"{ToPrettyString(uid):entity} stopped suffocating"); _alertsSystem.ClearAlert(uid, AlertType.LowOxygen); diff --git a/Content.Server/Chat/ChatSystem.cs b/Content.Server/Chat/ChatSystem.cs index 4ca731faca..9d66c36c41 100644 --- a/Content.Server/Chat/ChatSystem.cs +++ b/Content.Server/Chat/ChatSystem.cs @@ -36,7 +36,7 @@ public sealed class ChatSystem : SharedChatSystem [Dependency] private readonly IAdminManager _adminManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly AdminLogSystem _logs = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; [Dependency] private readonly ListeningSystem _listener = default!; [Dependency] private readonly InventorySystem _inventory = default!; @@ -155,7 +155,7 @@ public sealed class ChatSystem : SharedChatSystem var ev = new EntitySpokeEvent(message); RaiseLocalEvent(source, ev, false); - _logs.Add(LogType.Chat, LogImpact.Low, $"Say from {ToPrettyString(source):user}: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Say from {ToPrettyString(source):user}: {message}"); } private void SendEntityWhisper(EntityUid source, string message, bool hideChat = false) @@ -199,7 +199,7 @@ public sealed class ChatSystem : SharedChatSystem var ev = new EntitySpokeEvent(message); RaiseLocalEvent(source, ev, false); - _logs.Add(LogType.Chat, LogImpact.Low, $"Whisper from {ToPrettyString(source):user}: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Whisper from {ToPrettyString(source):user}: {message}"); } private void SendEntityEmote(EntityUid source, string action, bool hideChat) @@ -210,7 +210,7 @@ public sealed class ChatSystem : SharedChatSystem ("entityName", Name(source))); SendInVoiceRange(ChatChannel.Emotes, action, messageWrap, source, hideChat); - _logs.Add(LogType.Chat, LogImpact.Low, $"Emote from {ToPrettyString(source):user}: {action}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Emote from {ToPrettyString(source):user}: {action}"); } // ReSharper disable once InconsistentNaming @@ -225,7 +225,7 @@ public sealed class ChatSystem : SharedChatSystem ("entityName", Name(source))); SendInVoiceRange(ChatChannel.LOOC, message, messageWrap, source, hideChat); - _logs.Add(LogType.Chat, LogImpact.Low, $"LOOC from {player:Player}: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"LOOC from {player:Player}: {message}"); } private void SendDeadChat(EntityUid source, IPlayerSession player, string message, bool hideChat) @@ -238,18 +238,18 @@ public sealed class ChatSystem : SharedChatSystem messageWrap = Loc.GetString("chat-manager-send-admin-dead-chat-wrap-message", ("adminChannelName", Loc.GetString("chat-manager-admin-channel-name")), ("userName", player.ConnectedClient.UserName)); - _logs.Add(LogType.Chat, LogImpact.Low, $"Dead chat from {player:Player}: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Dead chat from {player:Player}: {message}"); } else { messageWrap = Loc.GetString("chat-manager-send-dead-chat-wrap-message", ("deadChannelName", Loc.GetString("chat-manager-dead-channel-name")), ("playerName", (playerName))); - _logs.Add(LogType.Chat, LogImpact.Low, $"Admin dead chat from {player:Player}: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Admin dead chat from {player:Player}: {message}"); } _chatManager.ChatMessageToMany(ChatChannel.Dead, message, messageWrap, source, hideChat, clients.ToList()); - _logs.Add(LogType.Chat, LogImpact.Low, $"Dead chat from {player:Player}: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Dead chat from {player:Player}: {message}"); } #endregion diff --git a/Content.Server/Chat/Managers/ChatManager.cs b/Content.Server/Chat/Managers/ChatManager.cs index 09a187f010..d62b38fcee 100644 --- a/Content.Server/Chat/Managers/ChatManager.cs +++ b/Content.Server/Chat/Managers/ChatManager.cs @@ -32,11 +32,10 @@ namespace Content.Server.Chat.Managers [Dependency] private readonly IServerNetManager _netManager = default!; [Dependency] private readonly IMoMMILink _mommiLink = default!; [Dependency] private readonly IAdminManager _adminManager = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IServerPreferencesManager _preferencesManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!; - private AdminLogSystem _logs = default!; - /// /// The maximum length a player-sent message can be sent /// @@ -47,7 +46,6 @@ namespace Content.Server.Chat.Managers public void Initialize() { - _logs = EntitySystem.Get(); _netManager.RegisterNetMessage(); _configurationManager.OnValueChanged(CCVars.OocEnabled, OnOocEnabledChanged, true); @@ -78,7 +76,7 @@ namespace Content.Server.Chat.Managers ChatMessageToAll(ChatChannel.Server, message, messageWrap, colorOverride); Logger.InfoS("SERVER", message); - _logs.Add(LogType.Chat, LogImpact.Low, $"Server announcement: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server announcement: {message}"); } public void DispatchStationAnnouncement(string message, string sender = "Central Command", bool playDefaultSound = true, Color? colorOverride = null) @@ -90,7 +88,7 @@ namespace Content.Server.Chat.Managers SoundSystem.Play(Filter.Broadcast(), "/Audio/Announcements/announce.ogg", AudioParams.Default.WithVolume(-2f)); } - _logs.Add(LogType.Chat, LogImpact.Low, $"Station Announcement from {sender}: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Station Announcement from {sender}: {message}"); } public void DispatchServerMessage(IPlayerSession player, string message) @@ -98,7 +96,7 @@ namespace Content.Server.Chat.Managers var messageWrap = Loc.GetString("chat-manager-server-wrap-message"); ChatMessageToOne(ChatChannel.Server, message, messageWrap, default, false, player.ConnectedClient); - _logs.Add(LogType.Chat, LogImpact.Low, $"Server message to {player:Player}: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server message to {player:Player}: {message}"); } public void SendAdminAnnouncement(string message) @@ -110,7 +108,7 @@ namespace Content.Server.Chat.Managers ("adminChannelName", Loc.GetString("chat-manager-admin-channel-name"))); ChatMessageToMany(ChatChannel.Admin, message, messageWrap, default, false, clients.ToList()); - _logs.Add(LogType.Chat, LogImpact.Low, $"Admin announcement from {message}: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Admin announcement from {message}: {message}"); } public void SendHookOOC(string sender, string message) @@ -122,7 +120,7 @@ namespace Content.Server.Chat.Managers message = FormattedMessage.EscapeText(message); var messageWrap = Loc.GetString("chat-manager-send-hook-ooc-wrap-message", ("senderName", sender)); ChatMessageToAll(ChatChannel.OOC, message, messageWrap); - _logs.Add(LogType.Chat, LogImpact.Low, $"Hook OOC from {sender}: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Hook OOC from {sender}: {message}"); } #endregion @@ -191,14 +189,14 @@ namespace Content.Server.Chat.Managers //TODO: player.Name color, this will need to change the structure of the MsgChatMessage ChatMessageToAll(ChatChannel.OOC, message, messageWrap, colorOverride); _mommiLink.SendOOCMessage(player.Name, message); - _logs.Add(LogType.Chat, LogImpact.Low, $"OOC from {player:Player}: {message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"OOC from {player:Player}: {message}"); } private void SendAdminChat(IPlayerSession player, string message) { if (!_adminManager.IsAdmin(player)) { - _logs.Add(LogType.Chat, LogImpact.Extreme, $"{player:Player} attempted to send admin message but was not admin"); + _adminLogger.Add(LogType.Chat, LogImpact.Extreme, $"{player:Player} attempted to send admin message but was not admin"); return; } @@ -208,7 +206,7 @@ namespace Content.Server.Chat.Managers ("playerName", player.Name)); ChatMessageToMany(ChatChannel.Admin, message, messageWrap, default, false, clients.ToList()); - _logs.Add(LogType.Chat, $"Admin chat from {player:Player}: {message}"); + _adminLogger.Add(LogType.Chat, $"Admin chat from {player:Player}: {message}"); } #endregion diff --git a/Content.Server/Chat/SuicideSystem.cs b/Content.Server/Chat/SuicideSystem.cs index d01653c9e5..79f5f3f58f 100644 --- a/Content.Server/Chat/SuicideSystem.cs +++ b/Content.Server/Chat/SuicideSystem.cs @@ -17,7 +17,7 @@ namespace Content.Server.Chat { [Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly EntityLookupSystem _entityLookupSystem = default!; - [Dependency] private readonly AdminLogSystem _adminLogSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly TagSystem _tagSystem = default!; @@ -35,7 +35,7 @@ namespace Content.Server.Chat return false; } - _adminLogSystem.Add(LogType.Suicide, + _adminLogger.Add(LogType.Suicide, $"{EntityManager.ToPrettyString(victim):player} is committing suicide"); var suicideEvent = new SuicideEvent(victim); diff --git a/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs b/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs index 489fe7d0d4..abec024e8c 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs @@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.EntitySystems var coordinates = Transform(owner).Coordinates; - _logSystem.Add(LogType.ChemicalReaction, reaction.Impact, + _adminLogger.Add(LogType.ChemicalReaction, reaction.Impact, $"Chemical reaction {reaction.ID:reaction} occurred with strength {unitReactions:strength} on entity {ToPrettyString(owner):metabolizer} at {coordinates}"); SoundSystem.Play(Filter.Pvs(owner, entityManager:EntityManager), reaction.Sound.GetSound(), owner); diff --git a/Content.Server/Chemistry/EntitySystems/ChemistrySystem.Injector.cs b/Content.Server/Chemistry/EntitySystems/ChemistrySystem.Injector.cs index 8f6145371f..1d3694ae17 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemistrySystem.Injector.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemistrySystem.Injector.cs @@ -206,7 +206,7 @@ public sealed partial class ChemistrySystem // Add an admin log, using the "force feed" log type. It's not quite feeding, but the effect is the same. if (component.ToggleState == SharedInjectorComponent.InjectorToggleMode.Inject) { - _logs.Add(LogType.ForceFeed, + _adminLogger.Add(LogType.ForceFeed, $"{EntityManager.ToPrettyString(user):user} is attempting to inject {EntityManager.ToPrettyString(target):target} with a solution {SolutionContainerSystem.ToPrettyString(solution):solution}"); } } @@ -216,7 +216,7 @@ public sealed partial class ChemistrySystem actualDelay /= 2; if (component.ToggleState == SharedInjectorComponent.InjectorToggleMode.Inject) - _logs.Add(LogType.Ingestion, + _adminLogger.Add(LogType.Ingestion, $"{EntityManager.ToPrettyString(user):user} is attempting to inject themselves with a solution {SolutionContainerSystem.ToPrettyString(solution):solution}."); } diff --git a/Content.Server/Chemistry/EntitySystems/ChemistrySystem.cs b/Content.Server/Chemistry/EntitySystems/ChemistrySystem.cs index 33f507dcb7..352d45fb63 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemistrySystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemistrySystem.cs @@ -7,7 +7,7 @@ namespace Content.Server.Chemistry.EntitySystems; public sealed partial class ChemistrySystem : EntitySystem { - [Dependency] private readonly AdminLogSystem _logs = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly BloodstreamSystem _blood = default!; [Dependency] private readonly DoAfterSystem _doAfter = default!; [Dependency] private readonly PopupSystem _popup = default!; diff --git a/Content.Server/CombatMode/CombatModeSystem.cs b/Content.Server/CombatMode/CombatModeSystem.cs index f10e6e6824..59c73a710f 100644 --- a/Content.Server/CombatMode/CombatModeSystem.cs +++ b/Content.Server/CombatMode/CombatModeSystem.cs @@ -20,7 +20,7 @@ namespace Content.Server.CombatMode [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly MeleeWeaponSystem _meleeWeaponSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; [Dependency] private readonly IRobustRandom _random = default!; public override void Initialize() @@ -87,7 +87,7 @@ namespace Content.Server.CombatMode _meleeWeaponSystem.SendAnimation("disarm", angle, args.Performer, args.Performer, new[] { args.Target }); SoundSystem.Play(filterAll, component.DisarmSuccessSound.GetSound(), args.Performer, AudioHelpers.WithVariation(0.025f)); - _logSystem.Add(LogType.DisarmedAction, $"{ToPrettyString(args.Performer):user} used disarm on {ToPrettyString(args.Target):target}"); + _adminLogger.Add(LogType.DisarmedAction, $"{ToPrettyString(args.Performer):user} used disarm on {ToPrettyString(args.Target):target}"); var eventArgs = new DisarmedEvent() { Target = args.Target, Source = args.Performer, PushProbability = component.DisarmPushChance }; RaiseLocalEvent(args.Target, eventArgs); diff --git a/Content.Server/Construction/AnchorableSystem.cs b/Content.Server/Construction/AnchorableSystem.cs index 1d8e98bd55..f6d86391dd 100644 --- a/Content.Server/Construction/AnchorableSystem.cs +++ b/Content.Server/Construction/AnchorableSystem.cs @@ -14,7 +14,7 @@ namespace Content.Server.Construction { public sealed class AnchorableSystem : SharedAnchorableSystem { - [Dependency] private readonly AdminLogSystem _adminLogs = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly ToolSystem _toolSystem = default!; [Dependency] private readonly PullingSystem _pullingSystem = default!; @@ -43,7 +43,7 @@ namespace Content.Server.Construction RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, args.Using), false); - _adminLogs.Add( + _adminLogger.Add( LogType.Action, LogImpact.Low, $"{EntityManager.ToPrettyString(args.User):user} unanchored {EntityManager.ToPrettyString(uid):anchored} using {EntityManager.ToPrettyString(args.Using):using}" @@ -78,7 +78,7 @@ namespace Content.Server.Construction RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, args.Using), false); - _adminLogs.Add( + _adminLogger.Add( LogType.Action, LogImpact.Low, $"{EntityManager.ToPrettyString(args.User):user} anchored {EntityManager.ToPrettyString(uid):anchored} using {EntityManager.ToPrettyString(args.Using):using}" diff --git a/Content.Server/Construction/Completions/AdminLog.cs b/Content.Server/Construction/Completions/AdminLog.cs index 52f34bb65b..9cde75ba0c 100644 --- a/Content.Server/Construction/Completions/AdminLog.cs +++ b/Content.Server/Construction/Completions/AdminLog.cs @@ -22,11 +22,11 @@ public sealed class AdminLog : IGraphAction public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager) { - var logSys = entityManager.EntitySysManager.GetEntitySystem(); + var logManager = IoCManager.Resolve(); if (userUid.HasValue) - logSys.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}, User: {entityManager.ToPrettyString(userUid.Value):user}"); + logManager.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}, User: {entityManager.ToPrettyString(userUid.Value):user}"); else - logSys.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}"); + logManager.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}"); } } diff --git a/Content.Server/Crayon/CrayonSystem.cs b/Content.Server/Crayon/CrayonSystem.cs index 7b8da02d48..75f9507457 100644 --- a/Content.Server/Crayon/CrayonSystem.cs +++ b/Content.Server/Crayon/CrayonSystem.cs @@ -20,7 +20,7 @@ namespace Content.Server.Crayon; public sealed class CrayonSystem : SharedCrayonSystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly AdminLogSystem _logs = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly DecalSystem _decals = default!; [Dependency] private readonly PopupSystem _popup = default!; @@ -73,7 +73,7 @@ public sealed class CrayonSystem : SharedCrayonSystem // Decrease "Ammo" component.Charges--; Dirty(component); - _logs.Add(LogType.CrayonDraw, LogImpact.Low, $"{EntityManager.ToPrettyString(args.User):user} drew a {component.Color:color} {component.SelectedState}"); + _adminLogger.Add(LogType.CrayonDraw, LogImpact.Low, $"{EntityManager.ToPrettyString(args.User):user} drew a {component.Color:color} {component.SelectedState}"); args.Handled = true; if (component.DeleteEmpty && component.Charges <= 0) diff --git a/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs b/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs index 7e268e54d2..0f6ea3d4e7 100644 --- a/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs +++ b/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs @@ -11,7 +11,7 @@ namespace Content.Server.Damage.Systems public sealed class DamageOnToolInteractSystem : EntitySystem { [Dependency] private readonly DamageableSystem _damageableSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; public override void Initialize() { @@ -33,7 +33,7 @@ namespace Content.Server.Damage.Systems var dmg = _damageableSystem.TryChangeDamage(args.Target, weldingDamage); if (dmg != null) - _logSystem.Add(LogType.Damaged, + _adminLogger.Add(LogType.Damaged, $"{ToPrettyString(args.User):user} used {ToPrettyString(args.Used):used} as a welder to deal {dmg.Total:damage} damage to {ToPrettyString(args.Target):target}"); args.Handled = true; @@ -45,7 +45,7 @@ namespace Content.Server.Damage.Systems var dmg = _damageableSystem.TryChangeDamage(args.Target, damage); if (dmg != null) - _logSystem.Add(LogType.Damaged, + _adminLogger.Add(LogType.Damaged, $"{ToPrettyString(args.User):user} used {ToPrettyString(args.Used):used} as a tool to deal {dmg.Total:damage} damage to {ToPrettyString(args.Target):target}"); args.Handled = true; diff --git a/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs b/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs index 7dbf9a0d90..4584c08278 100644 --- a/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs +++ b/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs @@ -10,7 +10,7 @@ namespace Content.Server.Damage.Systems public sealed class DamageOtherOnHitSystem : EntitySystem { [Dependency] private readonly DamageableSystem _damageableSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; public override void Initialize() { @@ -23,7 +23,7 @@ namespace Content.Server.Damage.Systems // Log damage only for mobs. Useful for when people throw spears at each other, but also avoids log-spam when explosions send glass shards flying. if (dmg != null && HasComp(args.Target)) - _logSystem.Add(LogType.ThrowHit, $"{ToPrettyString(args.Target):target} received {dmg.Total:damage} damage from collision"); + _adminLogger.Add(LogType.ThrowHit, $"{ToPrettyString(args.Target):target} received {dmg.Total:damage} damage from collision"); } } } diff --git a/Content.Server/Electrocution/ElectrocutionSystem.cs b/Content.Server/Electrocution/ElectrocutionSystem.cs index 6c0b85661e..85134c2ea6 100644 --- a/Content.Server/Electrocution/ElectrocutionSystem.cs +++ b/Content.Server/Electrocution/ElectrocutionSystem.cs @@ -41,7 +41,7 @@ namespace Content.Server.Electrocution [Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly NodeGroupSystem _nodeGroupSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; [Dependency] private readonly TagSystem _tagSystem = default!; private const string StatusEffectKey = "Electrocution"; @@ -105,7 +105,7 @@ namespace Content.Server.Electrocution var actual = _damageableSystem.TryChangeDamage(finished.Electrocuting, damage); if (actual != null) { - _logSystem.Add(LogType.Electrocution, + _adminLogger.Add(LogType.Electrocution, $"{ToPrettyString(finished.Owner):entity} received {actual.Total:damage} powered electrocution damage"); } } @@ -361,7 +361,7 @@ namespace Content.Server.Electrocution if (actual != null) { - _logSystem.Add(LogType.Electrocution, + _adminLogger.Add(LogType.Electrocution, $"{ToPrettyString(statusEffects.Owner):entity} received {actual.Total:damage} powered electrocution damage"); } } diff --git a/Content.Server/Emag/EmagSystem.cs b/Content.Server/Emag/EmagSystem.cs index 8cb0a90139..9a9f56a402 100644 --- a/Content.Server/Emag/EmagSystem.cs +++ b/Content.Server/Emag/EmagSystem.cs @@ -12,7 +12,7 @@ namespace Content.Server.Emag public sealed class EmagSystem : EntitySystem { [Dependency] private readonly SharedPopupSystem _popupSystem = default!; - [Dependency] private readonly SharedAdminLogSystem _adminLog = default!; + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly TagSystem _tagSystem = default!; @@ -66,7 +66,7 @@ namespace Content.Server.Emag if (emaggedEvent.Handled) { _popupSystem.PopupEntity(Loc.GetString("emag-success", ("target", args.Target)), args.User, Filter.Entities(args.User)); - _adminLog.Add(LogType.Emag, LogImpact.High, $"{ToPrettyString(args.User):player} emagged {ToPrettyString(args.Target.Value):target}"); + _adminLogger.Add(LogType.Emag, LogImpact.High, $"{ToPrettyString(args.User):player} emagged {ToPrettyString(args.Target.Value):target}"); component.Charges--; return; } diff --git a/Content.Server/Entry/EntryPoint.cs b/Content.Server/Entry/EntryPoint.cs index a6375b2918..60c4aaff3f 100644 --- a/Content.Server/Entry/EntryPoint.cs +++ b/Content.Server/Entry/EntryPoint.cs @@ -1,4 +1,5 @@ using Content.Server.Administration; +using Content.Server.Administration.Logs; using Content.Server.Administration.Managers; using Content.Server.Afk; using Content.Server.AI.Utility; @@ -81,6 +82,7 @@ namespace Content.Server.Entry logManager.GetSawmill("Storage").Level = LogLevel.Info; logManager.GetSawmill("db.ef").Level = LogLevel.Info; + IoCManager.Resolve().Initialize(); IoCManager.Resolve().Initialize(); IoCManager.Resolve().Init(); IoCManager.Resolve().Init(); diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index 231e8badeb..6213bd7961 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -33,7 +33,7 @@ public sealed partial class ExplosionSystem : EntitySystem [Dependency] private readonly NodeGroupSystem _nodeGroupSystem = default!; [Dependency] private readonly CameraRecoilSystem _recoilSystem = default!; [Dependency] private readonly EntityLookupSystem _entityLookup = default!; - [Dependency] private readonly AdminLogSystem _logsSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly ThrowingSystem _throwingSystem = default!; [Dependency] private readonly SharedTransformSystem _transformSystem = default!; @@ -213,10 +213,10 @@ public sealed partial class ExplosionSystem : EntitySystem return; if (user == null) - _logsSystem.Add(LogType.Explosion, LogImpact.High, + _adminLogger.Add(LogType.Explosion, LogImpact.High, $"{ToPrettyString(uid):entity} exploded at {pos:coordinates} with intensity {totalIntensity} slope {slope}"); else - _logsSystem.Add(LogType.Explosion, LogImpact.High, + _adminLogger.Add(LogType.Explosion, LogImpact.High, $"{ToPrettyString(user.Value):user} caused {ToPrettyString(uid):entity} to explode at {pos:coordinates} with intensity {totalIntensity} slope {slope}"); } @@ -243,8 +243,8 @@ public sealed partial class ExplosionSystem : EntitySystem } if (addLog) // dont log if already created a separate, more detailed, log. - _logsSystem.Add(LogType.Explosion, LogImpact.High, $"Explosion spawned at {epicenter:coordinates} with intensity {totalIntensity} slope {slope}"); - + _adminLogger.Add(LogType.Explosion, LogImpact.High, $"Explosion spawned at {epicenter:coordinates} with intensity {totalIntensity} slope {slope}"); + _explosionQueue.Enqueue(() => SpawnExplosion(epicenter, type, totalIntensity, slope, maxTileIntensity, tileBreakScale, maxTileBreak, canCreateVacuum)); } diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs index 0d04cf2bb5..f04623e2d2 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs @@ -38,7 +38,7 @@ namespace Content.Server.Explosion.EntitySystems [Dependency] private readonly FixtureSystem _fixtures = default!; [Dependency] private readonly FlashSystem _flashSystem = default!; [Dependency] private readonly SharedBroadphaseSystem _broadphase = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; public override void Initialize() { @@ -106,12 +106,12 @@ namespace Content.Server.Explosion.EntitySystems if (user != null) { - _logSystem.Add(LogType.Trigger, + _adminLogger.Add(LogType.Trigger, $"{ToPrettyString(user.Value):user} started a {delay} second timer trigger on entity {ToPrettyString(uid):timer}"); } else { - _logSystem.Add(LogType.Trigger, + _adminLogger.Add(LogType.Trigger, $"{delay} second timer trigger started on entity {ToPrettyString(uid):timer}"); } diff --git a/Content.Server/Fluids/EntitySystems/SpillableSystem.cs b/Content.Server/Fluids/EntitySystems/SpillableSystem.cs index fd8a7dd19c..502ba4ca30 100644 --- a/Content.Server/Fluids/EntitySystems/SpillableSystem.cs +++ b/Content.Server/Fluids/EntitySystems/SpillableSystem.cs @@ -25,7 +25,7 @@ public sealed class SpillableSystem : EntitySystem [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly EntityLookupSystem _entityLookup = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; public override void Initialize() { @@ -84,7 +84,7 @@ public sealed class SpillableSystem : EntitySystem if (args.User != null) { - _logSystem.Add(LogType.Landed, + _adminLogger.Add(LogType.Landed, $"{ToPrettyString(uid):entity} spilled a solution {SolutionContainerSystem.ToPrettyString(solution):solution} on landing"); } diff --git a/Content.Server/GameTicking/Events/RoundStartingEvent.cs b/Content.Server/GameTicking/Events/RoundStartingEvent.cs index 0a0a4c085d..cc3ada337b 100644 --- a/Content.Server/GameTicking/Events/RoundStartingEvent.cs +++ b/Content.Server/GameTicking/Events/RoundStartingEvent.cs @@ -5,4 +5,10 @@ /// public sealed class RoundStartingEvent : EntityEventArgs { + public RoundStartingEvent(int id) + { + Id = id; + } + + public int Id { get; } } diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index 444f42bec3..232cf59987 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -161,7 +161,7 @@ namespace Content.Server.GameTicking return await _db.AddNewRound(server, playerIds); }).Result; - var startingEvent = new RoundStartingEvent(); + var startingEvent = new RoundStartingEvent(RoundId); RaiseLocalEvent(startingEvent); List readyPlayers; diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index d5f5f06daa..9a6ae7be85 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -179,9 +179,9 @@ namespace Content.Server.GameTicking _stationJobs.TryAssignJob(station, jobPrototype); if (lateJoin) - _adminLogSystem.Add(LogType.LateJoin, LogImpact.Medium, $"Player {player.Name} late joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {job.Name:jobName}."); + _adminLogger.Add(LogType.LateJoin, LogImpact.Medium, $"Player {player.Name} late joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {job.Name:jobName}."); else - _adminLogSystem.Add(LogType.RoundStartJoin, LogImpact.Medium, $"Player {player.Name} joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {job.Name:jobName}."); + _adminLogger.Add(LogType.RoundStartJoin, LogImpact.Medium, $"Player {player.Name} joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {job.Name:jobName}."); // Make sure they're aware of extended access. if (Comp(station).ExtendedAccess @@ -199,7 +199,7 @@ namespace Content.Server.GameTicking public void Respawn(IPlayerSession player) { player.ContentData()?.WipeMind(); - _adminLogSystem.Add(LogType.Respawn, LogImpact.Medium, $"Player {player} was respawned."); + _adminLogger.Add(LogType.Respawn, LogImpact.Medium, $"Player {player} was respawned."); if (LobbyEnabled) PlayerJoinLobby(player); diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index c77a5c088b..2f4f73bc4a 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -104,6 +104,7 @@ namespace Content.Server.GameTicking [Dependency] private readonly IWatchdogApi _watchdogApi = default!; [Dependency] private readonly IGameMapManager _gameMapManager = default!; [Dependency] private readonly IServerDbManager _db = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly ILogManager _logManager = default!; [Dependency] private readonly IConsoleHost _consoleHost = default!; #if EXCEPTION_TOLERANCE @@ -112,7 +113,6 @@ namespace Content.Server.GameTicking [Dependency] private readonly StationSystem _stationSystem = default!; [Dependency] private readonly StationSpawningSystem _stationSpawning = default!; [Dependency] private readonly StationJobsSystem _stationJobs = default!; - [Dependency] private readonly AdminLogSystem _adminLogSystem = default!; [Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly GhostSystem _ghosts = default!; [Dependency] private readonly RoleBanManager _roleBanManager = default!; diff --git a/Content.Server/Ghost/Roles/GhostRoleSystem.cs b/Content.Server/Ghost/Roles/GhostRoleSystem.cs index ef194faacb..e8b5227d97 100644 --- a/Content.Server/Ghost/Roles/GhostRoleSystem.cs +++ b/Content.Server/Ghost/Roles/GhostRoleSystem.cs @@ -27,7 +27,7 @@ namespace Content.Server.Ghost.Roles { [Dependency] private readonly EuiManager _euiManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; - [Dependency] private readonly AdminLogSystem _adminLogSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly FollowerSystem _followerSystem = default!; private uint _nextRoleIdentifier; @@ -182,7 +182,7 @@ namespace Content.Server.Ghost.Roles if (!role.Take(player)) return; if (player.AttachedEntity != null) - _adminLogSystem.Add(LogType.GhostRoleTaken, LogImpact.Low, $"{player:player} took the {role.RoleName:roleName} ghost role {ToPrettyString(player.AttachedEntity.Value):entity}"); + _adminLogger.Add(LogType.GhostRoleTaken, LogImpact.Low, $"{player:player} took the {role.RoleName:roleName} ghost role {ToPrettyString(player.AttachedEntity.Value):entity}"); CloseEui(player); } diff --git a/Content.Server/Interaction/InteractionSystem.cs b/Content.Server/Interaction/InteractionSystem.cs index 1fbbea5402..67a54f9c6c 100644 --- a/Content.Server/Interaction/InteractionSystem.cs +++ b/Content.Server/Interaction/InteractionSystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Interaction { [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly PullingSystem _pullSystem = default!; - [Dependency] private readonly AdminLogSystem _adminLogSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; public override void Initialize() @@ -219,7 +219,7 @@ namespace Content.Server.Interaction if (ev.Handled) { - _adminLogSystem.Add(LogType.AttackArmedWide, LogImpact.Low, $"{ToPrettyString(user):user} wide attacked with {ToPrettyString(item.Value):used} at {coordinates}"); + _adminLogger.Add(LogType.AttackArmedWide, LogImpact.Low, $"{ToPrettyString(user):user} wide attacked with {ToPrettyString(item.Value):used} at {coordinates}"); return; } } @@ -232,12 +232,12 @@ namespace Content.Server.Interaction { if (target != null) { - _adminLogSystem.Add(LogType.AttackArmedClick, LogImpact.Low, + _adminLogger.Add(LogType.AttackArmedClick, LogImpact.Low, $"{ToPrettyString(user):user} attacked {ToPrettyString(target.Value):target} with {ToPrettyString(item.Value):used} at {coordinates}"); } else { - _adminLogSystem.Add(LogType.AttackArmedClick, LogImpact.Low, + _adminLogger.Add(LogType.AttackArmedClick, LogImpact.Low, $"{ToPrettyString(user):user} attacked with {ToPrettyString(item.Value):used} at {coordinates}"); } @@ -260,7 +260,7 @@ namespace Content.Server.Interaction var ev = new WideAttackEvent(user, user, coordinates); RaiseLocalEvent(user, ev, false); if (ev.Handled) - _adminLogSystem.Add(LogType.AttackUnarmedWide, LogImpact.Low, $"{ToPrettyString(user):user} wide attacked at {coordinates}"); + _adminLogger.Add(LogType.AttackUnarmedWide, LogImpact.Low, $"{ToPrettyString(user):user} wide attacked at {coordinates}"); } else { @@ -270,12 +270,12 @@ namespace Content.Server.Interaction { if (target != null) { - _adminLogSystem.Add(LogType.AttackUnarmedClick, LogImpact.Low, + _adminLogger.Add(LogType.AttackUnarmedClick, LogImpact.Low, $"{ToPrettyString(user):user} attacked {ToPrettyString(target.Value):target} at {coordinates}"); } else { - _adminLogSystem.Add(LogType.AttackUnarmedClick, LogImpact.Low, + _adminLogger.Add(LogType.AttackUnarmedClick, LogImpact.Low, $"{ToPrettyString(user):user} attacked at {coordinates}"); } } diff --git a/Content.Server/IoC/ServerContentIoC.cs b/Content.Server/IoC/ServerContentIoC.cs index 0ed41c6b3d..29a19a81ba 100644 --- a/Content.Server/IoC/ServerContentIoC.cs +++ b/Content.Server/IoC/ServerContentIoC.cs @@ -1,4 +1,5 @@ using Content.Server.Administration; +using Content.Server.Administration.Logs; using Content.Server.Administration.Managers; using Content.Server.Administration.Notes; using Content.Server.Afk; @@ -20,6 +21,7 @@ using Content.Server.Objectives.Interfaces; using Content.Server.Preferences.Managers; using Content.Server.Voting.Managers; using Content.Shared.Administration; +using Content.Shared.Administration.Logs; using Content.Shared.Kitchen; using Content.Shared.Module; @@ -54,6 +56,8 @@ namespace Content.Server.IoC IoCManager.Register(); IoCManager.Register(); IoCManager.Register(); + IoCManager.Register(); + IoCManager.Register(); } } } diff --git a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs index 51ab820735..b6314c0ce3 100644 --- a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs +++ b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Light.EntitySystems [Dependency] private readonly SharedAmbientSoundSystem _ambientSystem = default!; [Dependency] private readonly LightBulbSystem _bulbSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SignalLinkerSystem _signalSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; @@ -111,7 +111,7 @@ namespace Content.Server.Light.EntitySystems var damage = _damageableSystem.TryChangeDamage(userUid, light.Damage); if (damage != null) - _logSystem.Add(LogType.Damaged, + _adminLogger.Add(LogType.Damaged, $"{ToPrettyString(args.User):user} burned their hand on {ToPrettyString(args.Target):target} and received {damage.Total:damage} damage"); SoundSystem.Play(Filter.Pvs(uid), light.BurnHandSound.GetSound(), uid); diff --git a/Content.Server/Medical/HealingSystem.cs b/Content.Server/Medical/HealingSystem.cs index bc8f39962f..64e1057df6 100644 --- a/Content.Server/Medical/HealingSystem.cs +++ b/Content.Server/Medical/HealingSystem.cs @@ -18,7 +18,7 @@ namespace Content.Server.Medical; public sealed class HealingSystem : EntitySystem { - [Dependency] private readonly AdminLogSystem _logs = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!; [Dependency] private readonly DoAfterSystem _doAfter = default!; @@ -59,9 +59,9 @@ public sealed class HealingSystem : EntitySystem _stacks.Use(args.Component.Owner, 1, stack); if (uid != args.User) - _logs.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed {EntityManager.ToPrettyString(uid):target} for {healed.Total:damage} damage"); + _adminLogger.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed {EntityManager.ToPrettyString(uid):target} for {healed.Total:damage} damage"); else - _logs.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed themselves for {healed.Total:damage} damage"); + _adminLogger.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed themselves for {healed.Total:damage} damage"); if (args.Component.HealingEndSound != null) { diff --git a/Content.Server/Nutrition/Components/HungerComponent.cs b/Content.Server/Nutrition/Components/HungerComponent.cs index 237ebed578..daa85433c6 100644 --- a/Content.Server/Nutrition/Components/HungerComponent.cs +++ b/Content.Server/Nutrition/Components/HungerComponent.cs @@ -196,10 +196,11 @@ namespace Content.Server.Nutrition.Components // _trySound(calculatedThreshold); if (calculatedHungerThreshold != _currentHungerThreshold) { + var logManager = IoCManager.Resolve(); if (_currentHungerThreshold == HungerThreshold.Dead) - EntitySystem.Get().Add(LogType.Hunger, $"{_entMan.ToPrettyString(Owner):entity} has stopped starving"); + logManager.Add(LogType.Hunger, $"{_entMan.ToPrettyString(Owner):entity} has stopped starving"); else if (calculatedHungerThreshold == HungerThreshold.Dead) - EntitySystem.Get().Add(LogType.Hunger, $"{_entMan.ToPrettyString(Owner):entity} has started starving"); + logManager.Add(LogType.Hunger, $"{_entMan.ToPrettyString(Owner):entity} has started starving"); _currentHungerThreshold = calculatedHungerThreshold; HungerThresholdEffect(); diff --git a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs index d5fd13c79e..89e63efb06 100644 --- a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs @@ -37,7 +37,7 @@ namespace Content.Server.Nutrition.EntitySystems [Dependency] private readonly BodySystem _bodySystem = default!; [Dependency] private readonly StomachSystem _stomachSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!; - [Dependency] private readonly SharedAdminLogSystem _logSystem = default!; + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly SpillableSystem _spillableSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; @@ -227,7 +227,7 @@ namespace Content.Server.Nutrition.EntitySystems user, Filter.Entities(target)); // logging - _logSystem.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(user):user} is forcing {ToPrettyString(target):target} to drink {ToPrettyString(drink.Owner):drink} {SolutionContainerSystem.ToPrettyString(drinkSolution)}"); + _adminLogger.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(user):user} is forcing {ToPrettyString(target):target} to drink {ToPrettyString(drink.Owner):drink} {SolutionContainerSystem.ToPrettyString(drinkSolution)}"); } drink.CancelToken = new CancellationTokenSource(); diff --git a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs index 005416184e..f983293427 100644 --- a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs @@ -34,7 +34,7 @@ namespace Content.Server.Nutrition.EntitySystems [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly UtensilSystem _utensilSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!; - [Dependency] private readonly SharedAdminLogSystem _logSystem = default!; + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; @@ -121,7 +121,7 @@ namespace Content.Server.Nutrition.EntitySystems user, Filter.Entities(target)); // logging - _logSystem.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(user):user} is forcing {ToPrettyString(target):target} to eat {ToPrettyString(food.Owner):food} {SolutionContainerSystem.ToPrettyString(foodSolution)}"); + _adminLogger.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(user):user} is forcing {ToPrettyString(target):target} to eat {ToPrettyString(food.Owner):food} {SolutionContainerSystem.ToPrettyString(foodSolution)}"); } var moveBreak = user != target; @@ -290,9 +290,9 @@ namespace Content.Server.Nutrition.EntitySystems // logging if (user == null) - _logSystem.Add(LogType.ForceFeed, $"{ToPrettyString(uid):food} {SolutionContainerSystem.ToPrettyString(foodSolution):solution} was thrown into the mouth of {ToPrettyString(target):target}"); + _adminLogger.Add(LogType.ForceFeed, $"{ToPrettyString(uid):food} {SolutionContainerSystem.ToPrettyString(foodSolution):solution} was thrown into the mouth of {ToPrettyString(target):target}"); else - _logSystem.Add(LogType.ForceFeed, $"{ToPrettyString(user.Value):user} threw {ToPrettyString(uid):food} {SolutionContainerSystem.ToPrettyString(foodSolution):solution} into the mouth of {ToPrettyString(target):target}"); + _adminLogger.Add(LogType.ForceFeed, $"{ToPrettyString(user.Value):user} threw {ToPrettyString(uid):food} {SolutionContainerSystem.ToPrettyString(foodSolution):solution} into the mouth of {ToPrettyString(target):target}"); var filter = user == null ? Filter.Entities(target) : Filter.Entities(target, user.Value); _popupSystem.PopupEntity(Loc.GetString(food.EatMessage, ("food", food.Owner)), target, filter); diff --git a/Content.Server/Nutrition/EntitySystems/ThirstSystem.cs b/Content.Server/Nutrition/EntitySystems/ThirstSystem.cs index 9a38d566de..cfbcf9d72f 100644 --- a/Content.Server/Nutrition/EntitySystems/ThirstSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/ThirstSystem.cs @@ -16,7 +16,7 @@ namespace Content.Server.Nutrition.EntitySystems { [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly AlertsSystem _alerts = default!; - [Dependency] private readonly AdminLogSystem _adminlog = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly DamageableSystem _damage = default!; [Dependency] private readonly MovementSpeedModifierSystem _movement = default!; @@ -136,9 +136,9 @@ namespace Content.Server.Nutrition.EntitySystems if (calculatedThirstThreshold != component.CurrentThirstThreshold) { if (component.CurrentThirstThreshold == ThirstThreshold.Dead) - _adminlog.Add(LogType.Thirst, $"{EntityManager.ToPrettyString(component.Owner):entity} has stopped taking dehydration damage"); + _adminLogger.Add(LogType.Thirst, $"{EntityManager.ToPrettyString(component.Owner):entity} has stopped taking dehydration damage"); else if (calculatedThirstThreshold == ThirstThreshold.Dead) - _adminlog.Add(LogType.Thirst, $"{EntityManager.ToPrettyString(component.Owner):entity} has started taking dehydration damage"); + _adminLogger.Add(LogType.Thirst, $"{EntityManager.ToPrettyString(component.Owner):entity} has started taking dehydration damage"); component.CurrentThirstThreshold = calculatedThirstThreshold; UpdateEffects(component); diff --git a/Content.Server/Payload/EntitySystems/PayloadSystem.cs b/Content.Server/Payload/EntitySystems/PayloadSystem.cs index 5edb955076..870bec9c8c 100644 --- a/Content.Server/Payload/EntitySystems/PayloadSystem.cs +++ b/Content.Server/Payload/EntitySystems/PayloadSystem.cs @@ -15,7 +15,7 @@ public sealed class PayloadSystem : EntitySystem { [Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly SolutionContainerSystem _solutionSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; [Dependency] private readonly IComponentFactory _componentFactory = default!; [Dependency] private readonly ISerializationManager _serializationManager = default!; @@ -123,7 +123,7 @@ public sealed class PayloadSystem : EntitySystem var solStringA = SolutionContainerSystem.ToPrettyString(solutionA); var solStringB = SolutionContainerSystem.ToPrettyString(solutionB); - _logSystem.Add(LogType.ChemicalReaction, + _adminLogger.Add(LogType.ChemicalReaction, $"Chemical bomb payload {ToPrettyString(uid):payload} at {Transform(uid).MapPosition:location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}"); solutionA.MaxVolume += solutionB.MaxVolume; diff --git a/Content.Server/PowerCell/PowerCellSystem.cs b/Content.Server/PowerCell/PowerCellSystem.cs index ed319f2b2f..1a997bf484 100644 --- a/Content.Server/PowerCell/PowerCellSystem.cs +++ b/Content.Server/PowerCell/PowerCellSystem.cs @@ -17,7 +17,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem { [Dependency] private readonly SolutionContainerSystem _solutionsSystem = default!; [Dependency] private readonly ExplosionSystem _explosionSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; public override void Initialize() @@ -82,7 +82,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem private void Explode(EntityUid uid, BatteryComponent? battery = null) { - _logSystem.Add(LogType.Explosion, LogImpact.High, $"Sabotaged power cell {ToPrettyString(uid)} is exploding"); + _adminLogger.Add(LogType.Explosion, LogImpact.High, $"Sabotaged power cell {ToPrettyString(uid)} is exploding"); if (!Resolve(uid, ref battery)) return; @@ -112,7 +112,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem if (component.IsRigged) { - _logSystem.Add(LogType.Explosion, LogImpact.Medium, $"Power cell {ToPrettyString(uid)} has been rigged up to explode when used."); + _adminLogger.Add(LogType.Explosion, LogImpact.Medium, $"Power cell {ToPrettyString(uid)} has been rigged up to explode when used."); } } diff --git a/Content.Server/Projectiles/SharedProjectileSystem.cs b/Content.Server/Projectiles/SharedProjectileSystem.cs index dd4a8c6b87..22d205c064 100644 --- a/Content.Server/Projectiles/SharedProjectileSystem.cs +++ b/Content.Server/Projectiles/SharedProjectileSystem.cs @@ -21,7 +21,7 @@ namespace Content.Server.Projectiles public sealed class ProjectileSystem : SharedProjectileSystem { [Dependency] private readonly DamageableSystem _damageableSystem = default!; - [Dependency] private readonly AdminLogSystem _adminLogSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly CameraRecoilSystem _cameraRecoil = default!; [Dependency] private readonly GunSystem _guns = default!; @@ -46,7 +46,7 @@ namespace Content.Server.Projectiles if (modifiedDamage is not null && EntityManager.EntityExists(component.Shooter)) { - _adminLogSystem.Add(LogType.BulletHit, + _adminLogger.Add(LogType.BulletHit, HasComp(otherEntity) ? LogImpact.Extreme : LogImpact.High, $"Projectile {ToPrettyString(component.Owner):projectile} shot by {ToPrettyString(component.Shooter):user} hit {ToPrettyString(otherEntity):target} and dealt {modifiedDamage.Total:damage} damage"); } diff --git a/Content.Server/RCD/Systems/RCDSystem.cs b/Content.Server/RCD/Systems/RCDSystem.cs index b3ab1f68c5..c4743c3430 100644 --- a/Content.Server/RCD/Systems/RCDSystem.cs +++ b/Content.Server/RCD/Systems/RCDSystem.cs @@ -20,7 +20,7 @@ namespace Content.Server.RCD.Systems [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; [Dependency] private readonly IMapManager _mapManager = default!; - [Dependency] private readonly AdminLogSystem _logs = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly PopupSystem _popup = default!; @@ -114,20 +114,20 @@ namespace Content.Server.RCD.Systems //Floor mode just needs the tile to be a space tile (subFloor) case RcdMode.Floors: mapGrid.SetTile(snapPos, new Tile(_tileDefinitionManager["floor_steel"].TileId)); - _logs.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridIndex} {snapPos} to floor_steel"); + _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridIndex} {snapPos} to floor_steel"); break; //We don't want to place a space tile on something that's already a space tile. Let's do the inverse of the last check. case RcdMode.Deconstruct: if (!tile.IsBlockedTurf(true)) //Delete the turf { mapGrid.SetTile(snapPos, Tile.Empty); - _logs.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridIndex} tile: {snapPos} to space"); + _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridIndex} tile: {snapPos} to space"); } else //Delete what the user targeted { if (args.Target is {Valid: true} target) { - _logs.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to delete {ToPrettyString(target):target}"); + _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to delete {ToPrettyString(target):target}"); QueueDel(target); } } @@ -137,12 +137,12 @@ namespace Content.Server.RCD.Systems case RcdMode.Walls: var ent = EntityManager.SpawnEntity("WallSolid", mapGrid.GridTileToLocal(snapPos)); Transform(ent).LocalRotation = Angle.Zero; // Walls always need to point south. - _logs.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(ent)} at {snapPos} on grid {mapGrid.Index}"); + _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(ent)} at {snapPos} on grid {mapGrid.Index}"); break; case RcdMode.Airlock: var airlock = EntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos)); Transform(airlock).LocalRotation = Transform(rcd.Owner).LocalRotation; //Now apply icon smoothing. - _logs.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(airlock)} at {snapPos} on grid {mapGrid.Index}"); + _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(airlock)} at {snapPos} on grid {mapGrid.Index}"); break; default: args.Handled = true; diff --git a/Content.Server/Repairable/RepairableSystem.cs b/Content.Server/Repairable/RepairableSystem.cs index 510b159d54..76f9e6280c 100644 --- a/Content.Server/Repairable/RepairableSystem.cs +++ b/Content.Server/Repairable/RepairableSystem.cs @@ -11,7 +11,7 @@ namespace Content.Server.Repairable { [Dependency] private readonly ToolSystem _toolSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; public override void Initialize() { @@ -31,13 +31,13 @@ namespace Content.Server.Repairable if (component.Damage != null) { var damageChanged = _damageableSystem.TryChangeDamage(uid, component.Damage, true, false); - _logSystem.Add(LogType.Healed, $"{ToPrettyString(args.User):user} repaired {ToPrettyString(uid):target} by {damageChanged?.Total}"); + _adminLogger.Add(LogType.Healed, $"{ToPrettyString(args.User):user} repaired {ToPrettyString(uid):target} by {damageChanged?.Total}"); } else { // Repair all damage _damageableSystem.SetAllDamage(damageable, 0); - _logSystem.Add(LogType.Healed, $"{ToPrettyString(args.User):user} repaired {ToPrettyString(uid):target} back to full health"); + _adminLogger.Add(LogType.Healed, $"{ToPrettyString(args.User):user} repaired {ToPrettyString(uid):target} back to full health"); } diff --git a/Content.Server/RoundEnd/RoundEndSystem.cs b/Content.Server/RoundEnd/RoundEndSystem.cs index cdc57121ba..dec7c35417 100644 --- a/Content.Server/RoundEnd/RoundEndSystem.cs +++ b/Content.Server/RoundEnd/RoundEndSystem.cs @@ -17,7 +17,7 @@ namespace Content.Server.RoundEnd [Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly GameTicker _gameTicker = default!; - [Dependency] private readonly AdminLogSystem _adminLog = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; public TimeSpan DefaultCooldownDuration { get; set; } = TimeSpan.FromSeconds(30); @@ -73,11 +73,11 @@ namespace Content.Server.RoundEnd if (requester != null) { - _adminLog.Add(LogType.ShuttleCalled, LogImpact.High, $"Shuttle called by {ToPrettyString(requester.Value):user}"); + _adminLogger.Add(LogType.ShuttleCalled, LogImpact.High, $"Shuttle called by {ToPrettyString(requester.Value):user}"); } else { - _adminLog.Add(LogType.ShuttleCalled, LogImpact.High, $"Shuttle called"); + _adminLogger.Add(LogType.ShuttleCalled, LogImpact.High, $"Shuttle called"); } _chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-called-announcement",("minutes", countdownTime.Minutes)), Loc.GetString("Station"), false, Color.Gold); @@ -102,11 +102,11 @@ namespace Content.Server.RoundEnd if (requester != null) { - _adminLog.Add(LogType.ShuttleRecalled, LogImpact.High, $"Shuttle recalled by {ToPrettyString(requester.Value):user}"); + _adminLogger.Add(LogType.ShuttleRecalled, LogImpact.High, $"Shuttle recalled by {ToPrettyString(requester.Value):user}"); } else { - _adminLog.Add(LogType.ShuttleRecalled, LogImpact.High, $"Shuttle recalled"); + _adminLogger.Add(LogType.ShuttleRecalled, LogImpact.High, $"Shuttle recalled"); } _chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-recalled-announcement"), diff --git a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs index 1396ceb261..8989324504 100644 --- a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs @@ -24,7 +24,7 @@ namespace Content.Server.Singularity.EntitySystems public sealed class EmitterSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly AdminLogSystem _adminLog = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; public override void Initialize() { @@ -56,7 +56,7 @@ namespace Content.Server.Singularity.EntitySystems component.Owner.PopupMessage(args.User, Loc.GetString("comp-emitter-turned-off", ("target", component.Owner))); } - _adminLog.Add(LogType.Emitter, + _adminLogger.Add(LogType.Emitter, component.IsOn ? LogImpact.Medium : LogImpact.High, $"{ToPrettyString(args.User):player} toggled {ToPrettyString(uid):emitter}"); } diff --git a/Content.Server/StationEvents/Events/StationEvent.cs b/Content.Server/StationEvents/Events/StationEvent.cs index e2960ccffc..a85bf324b5 100644 --- a/Content.Server/StationEvents/Events/StationEvent.cs +++ b/Content.Server/StationEvents/Events/StationEvent.cs @@ -125,7 +125,7 @@ namespace Content.Server.StationEvents.Events Occurrences += 1; LastRun = EntitySystem.Get().RoundDuration(); - EntitySystem.Get() + IoCManager.Resolve() .Add(LogType.EventStarted, LogImpact.High, $"Event startup: {Name}"); } @@ -135,7 +135,7 @@ namespace Content.Server.StationEvents.Events /// public virtual void Announce() { - EntitySystem.Get() + IoCManager.Resolve() .Add(LogType.EventAnnounced, $"Event announce: {Name}"); if (StartAnnouncement != null) @@ -158,7 +158,7 @@ namespace Content.Server.StationEvents.Events /// public virtual void Shutdown() { - EntitySystem.Get() + IoCManager.Resolve() .Add(LogType.EventStopped, $"Event shutdown: {Name}"); if (EndAnnouncement != null) diff --git a/Content.Server/StationEvents/StationEventSystem.cs b/Content.Server/StationEvents/StationEventSystem.cs index 96d5c74de1..f2ee3329ec 100644 --- a/Content.Server/StationEvents/StationEventSystem.cs +++ b/Content.Server/StationEvents/StationEventSystem.cs @@ -28,7 +28,7 @@ namespace Content.Server.StationEvents [Dependency] private readonly GameTicker _gameTicker = default!; [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly AdminLogSystem _adminLog = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; public StationEvent? CurrentEvent { get; private set; } public IReadOnlyCollection StationEvents => _stationEvents; @@ -72,7 +72,7 @@ namespace Content.Server.StationEvents /// public string RunEvent(string name) { - _adminLog.Add(LogType.EventRan, LogImpact.High, $"Event run: {name}"); + _adminLogger.Add(LogType.EventRan, LogImpact.High, $"Event run: {name}"); // Could use a dictionary but it's such a minor thing, eh. // Wasn't sure on whether to localize this given it's a command diff --git a/Content.Server/Stunnable/StunSystem.cs b/Content.Server/Stunnable/StunSystem.cs index 117238ecc7..5e2f1458c7 100644 --- a/Content.Server/Stunnable/StunSystem.cs +++ b/Content.Server/Stunnable/StunSystem.cs @@ -15,7 +15,7 @@ namespace Content.Server.Stunnable public sealed class StunSystem : SharedStunSystem { [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly AdminLogSystem _adminLogSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; public override void Initialize() { @@ -42,7 +42,7 @@ namespace Content.Server.Stunnable source.PopupMessageOtherClients(Loc.GetString("stunned-component-disarm-success-others", ("source", Name(source)), ("target", Name(target)))); source.PopupMessageCursor(Loc.GetString("stunned-component-disarm-success", ("target", Name(target)))); - _adminLogSystem.Add(LogType.DisarmedKnockdown, LogImpact.Medium, $"{ToPrettyString(args.Source):user} knocked down {ToPrettyString(args.Target):target}"); + _adminLogger.Add(LogType.DisarmedKnockdown, LogImpact.Medium, $"{ToPrettyString(args.Source):user} knocked down {ToPrettyString(args.Target):target}"); args.Handled = true; } diff --git a/Content.Server/Temperature/Systems/TemperatureSystem.cs b/Content.Server/Temperature/Systems/TemperatureSystem.cs index add8d22bcd..62344e31f2 100644 --- a/Content.Server/Temperature/Systems/TemperatureSystem.cs +++ b/Content.Server/Temperature/Systems/TemperatureSystem.cs @@ -15,7 +15,7 @@ namespace Content.Server.Temperature.Systems [Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AlertsSystem _alertsSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger= default!; /// /// All the components that will have their damage updated at the end of the tick. @@ -163,7 +163,7 @@ namespace Content.Server.Temperature.Systems { if (!temperature.TakingDamage) { - _logSystem.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} started taking high temperature damage"); + _adminLogger.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} started taking high temperature damage"); temperature.TakingDamage = true; } @@ -175,7 +175,7 @@ namespace Content.Server.Temperature.Systems { if (!temperature.TakingDamage) { - _logSystem.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} started taking low temperature damage"); + _adminLogger.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} started taking low temperature damage"); temperature.TakingDamage = true; } @@ -186,7 +186,7 @@ namespace Content.Server.Temperature.Systems } else if (temperature.TakingDamage) { - _logSystem.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} stopped taking temperature damage"); + _adminLogger.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} stopped taking temperature damage"); temperature.TakingDamage = false; } } diff --git a/Content.Server/Verbs/VerbSystem.cs b/Content.Server/Verbs/VerbSystem.cs index 56b89e5975..ea67640f07 100644 --- a/Content.Server/Verbs/VerbSystem.cs +++ b/Content.Server/Verbs/VerbSystem.cs @@ -13,7 +13,7 @@ namespace Content.Server.Verbs { public sealed class VerbSystem : SharedVerbSystem { - [Dependency] private readonly SharedAdminLogSystem _logSystem = default!; + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly IAdminManager _adminMgr = default!; @@ -118,12 +118,12 @@ namespace Content.Server.Verbs if (holding == null) { - _logSystem.Add(LogType.Verb, verb.Impact, + _adminLogger.Add(LogType.Verb, verb.Impact, $"{ToPrettyString(user):user} {executionText} the [{verbText:verb}] verb targeting {ToPrettyString(target):target}"); } else { - _logSystem.Add(LogType.Verb, verb.Impact, + _adminLogger.Add(LogType.Verb, verb.Impact, $"{ToPrettyString(user):user} {executionText} the [{verbText:verb}] verb targeting {ToPrettyString(target):target} while holding {ToPrettyString(holding.Value):held}"); } } diff --git a/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs b/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs index 18f4a74732..adc06f82b5 100644 --- a/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs +++ b/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs @@ -30,7 +30,7 @@ namespace Content.Server.Weapon.Melee [Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly SolutionContainerSystem _solutionsSystem = default!; - [Dependency] private readonly AdminLogSystem _logSystem = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!; public const float DamagePitchVariation = 0.15f; @@ -100,10 +100,10 @@ namespace Content.Server.Weapon.Melee if (damageResult != null) { if (args.Used == args.User) - _logSystem.Add(LogType.MeleeHit, + _adminLogger.Add(LogType.MeleeHit, $"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(args.Target.Value):target} using their hands and dealt {damageResult.Total:damage} damage"); else - _logSystem.Add(LogType.MeleeHit, + _adminLogger.Add(LogType.MeleeHit, $"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(args.Target.Value):target} using {ToPrettyString(args.Used):used} and dealt {damageResult.Total:damage} damage"); } @@ -181,10 +181,10 @@ namespace Content.Server.Weapon.Melee if (damageResult != null) { if (args.Used == args.User) - _logSystem.Add(LogType.MeleeHit, + _adminLogger.Add(LogType.MeleeHit, $"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(entity):target} using their hands and dealt {damageResult.Total:damage} damage"); else - _logSystem.Add(LogType.MeleeHit, + _adminLogger.Add(LogType.MeleeHit, $"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(entity):target} using {ToPrettyString(args.Used):used} and dealt {damageResult.Total:damage} damage"); } } diff --git a/Content.Server/Weapon/Ranged/GunSystem.Guns.cs b/Content.Server/Weapon/Ranged/GunSystem.Guns.cs index 64c20a9304..cf171540d7 100644 --- a/Content.Server/Weapon/Ranged/GunSystem.Guns.cs +++ b/Content.Server/Weapon/Ranged/GunSystem.Guns.cs @@ -245,7 +245,7 @@ public sealed partial class GunSystem hitscan.FireEffects(shooter, distance, angle, result.HitEntity); var modifiedDamage = _damageable.TryChangeDamage(result.HitEntity, hitscan.Damage); if (modifiedDamage != null) - _logs.Add(LogType.HitScanHit, + _adminLogger.Add(LogType.HitScanHit, $"{EntityManager.ToPrettyString(shooter):user} hit {EntityManager.ToPrettyString(result.HitEntity):target} using {EntityManager.ToPrettyString(hitscan.Owner):used} and dealt {modifiedDamage.Total:damage} damage"); PlaySound(rayCastResults[0].HitEntity, modifiedDamage, hitscan.SoundHit, hitscan.ForceSound); diff --git a/Content.Server/Weapon/Ranged/GunSystem.cs b/Content.Server/Weapon/Ranged/GunSystem.cs index 5a97b9efc8..9ac7dc76c4 100644 --- a/Content.Server/Weapon/Ranged/GunSystem.cs +++ b/Content.Server/Weapon/Ranged/GunSystem.cs @@ -35,7 +35,7 @@ public sealed partial class GunSystem : EntitySystem [Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ActionBlockerSystem _blocker = default!; - [Dependency] private readonly AdminLogSystem _logs = default!; + [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly AtmosphereSystem _atmos = default!; [Dependency] private readonly CameraRecoilSystem _recoil = default!; [Dependency] private readonly DamageableSystem _damageable = default!; diff --git a/Content.Shared/Actions/SharedActionsSystem.cs b/Content.Shared/Actions/SharedActionsSystem.cs index b88eb23f43..b99c36d504 100644 --- a/Content.Shared/Actions/SharedActionsSystem.cs +++ b/Content.Shared/Actions/SharedActionsSystem.cs @@ -19,7 +19,7 @@ namespace Content.Shared.Actions; public abstract class SharedActionsSystem : EntitySystem { - [Dependency] private readonly SharedAdminLogSystem _logSystem = default!; + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; @@ -113,7 +113,7 @@ public abstract class SharedActionsSystem : EntitySystem // Does the user actually have the requested action? if (!component.Actions.TryGetValue(ev.Action, out var act)) { - _logSystem.Add(LogType.Action, + _adminLogger.Add(LogType.Action, $"{ToPrettyString(user):user} attempted to perform an action that they do not have: {ev.Action.Name}."); return; } @@ -146,10 +146,10 @@ public abstract class SharedActionsSystem : EntitySystem return; if (act.Provider == null) - _logSystem.Add(LogType.Action, + _adminLogger.Add(LogType.Action, $"{ToPrettyString(user):user} is performing the {name:action} action targeted at {ToPrettyString(entityTarget):target}."); else - _logSystem.Add(LogType.Action, + _adminLogger.Add(LogType.Action, $"{ToPrettyString(user):user} is performing the {name:action} action (provided by {ToPrettyString(act.Provider.Value):provider}) targeted at {ToPrettyString(entityTarget):target}."); if (entityAction.Event != null) @@ -174,10 +174,10 @@ public abstract class SharedActionsSystem : EntitySystem return; if (act.Provider == null) - _logSystem.Add(LogType.Action, + _adminLogger.Add(LogType.Action, $"{ToPrettyString(user):user} is performing the {name:action} action targeted at {mapTarget:target}."); else - _logSystem.Add(LogType.Action, + _adminLogger.Add(LogType.Action, $"{ToPrettyString(user):user} is performing the {name:action} action (provided by {ToPrettyString(act.Provider.Value):provider}) targeted at {mapTarget:target}."); if (worldAction.Event != null) @@ -194,10 +194,10 @@ public abstract class SharedActionsSystem : EntitySystem return; if (act.Provider == null) - _logSystem.Add(LogType.Action, + _adminLogger.Add(LogType.Action, $"{ToPrettyString(user):user} is performing the {name:action} action."); else - _logSystem.Add(LogType.Action, + _adminLogger.Add(LogType.Action, $"{ToPrettyString(user):user} is performing the {name:action} action provided by {ToPrettyString(act.Provider.Value):provider}."); performEvent = instantAction.Event; diff --git a/Content.Shared/Administration/Logs/ISharedAdminLogManager.cs b/Content.Shared/Administration/Logs/ISharedAdminLogManager.cs new file mode 100644 index 0000000000..d00d6a38de --- /dev/null +++ b/Content.Shared/Administration/Logs/ISharedAdminLogManager.cs @@ -0,0 +1,10 @@ +using Content.Shared.Database; + +namespace Content.Shared.Administration.Logs; + +public interface ISharedAdminLogManager +{ + void Add(LogType type, LogImpact impact, ref LogStringHandler handler); + + void Add(LogType type, ref LogStringHandler handler); +} diff --git a/Content.Shared/Administration/Logs/SharedAdminLogManager.cs b/Content.Shared/Administration/Logs/SharedAdminLogManager.cs new file mode 100644 index 0000000000..8641fa6e02 --- /dev/null +++ b/Content.Shared/Administration/Logs/SharedAdminLogManager.cs @@ -0,0 +1,17 @@ +using Content.Shared.Database; + +namespace Content.Shared.Administration.Logs; + +[Virtual] +public class SharedAdminLogManager : ISharedAdminLogManager +{ + public virtual void Add(LogType type, LogImpact impact, ref LogStringHandler handler) + { + // noop + } + + public virtual void Add(LogType type, ref LogStringHandler handler) + { + // noop + } +} diff --git a/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs b/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs index bed0109b8f..691b65ebe7 100644 --- a/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs +++ b/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs @@ -20,7 +20,7 @@ namespace Content.Shared.Chemistry.Reaction [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] protected readonly SharedAdminLogSystem _logSystem = default!; + [Dependency] protected readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly IGamePrototypeLoadManager _gamePrototypeLoadManager = default!; /// @@ -202,7 +202,7 @@ namespace Content.Shared.Chemistry.Reaction if (effect.ShouldLog) { var entity = args.SolutionEntity; - _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, + _adminLogger.Add(LogType.ReagentEffect, effect.LogImpact, $"Reaction effect {effect.GetType().Name:effect} of reaction ${reaction.ID:reaction} applied on entity {ToPrettyString(entity):entity} at {Transform(entity).Coordinates:coordinates}"); } diff --git a/Content.Shared/Chemistry/ReactiveSystem.cs b/Content.Shared/Chemistry/ReactiveSystem.cs index 6b9e4a03af..1a57d286e0 100644 --- a/Content.Shared/Chemistry/ReactiveSystem.cs +++ b/Content.Shared/Chemistry/ReactiveSystem.cs @@ -15,7 +15,7 @@ namespace Content.Shared.Chemistry { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; - [Dependency] private readonly SharedAdminLogSystem _logSystem = default!; + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; public void ReactionEntity(EntityUid uid, ReactionMethod method, Solution solution) { @@ -63,7 +63,7 @@ namespace Content.Shared.Chemistry if (effect.ShouldLog) { var entity = args.SolutionEntity; - _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, + _adminLogger.Add(LogType.ReagentEffect, effect.LogImpact, $"Reactive effect {effect.GetType().Name:effect} of reagent {reagent.ID:reagent} with method {method} applied on entity {ToPrettyString(entity):entity} at {Transform(entity).Coordinates:coordinates}"); } @@ -91,7 +91,7 @@ namespace Content.Shared.Chemistry if (effect.ShouldLog) { var entity = args.SolutionEntity; - _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, + _adminLogger.Add(LogType.ReagentEffect, effect.LogImpact, $"Reactive effect {effect.GetType().Name:effect} of {ToPrettyString(entity):entity} using reagent {reagent.ID:reagent} with method {method} at {Transform(entity).Coordinates:coordinates}"); } diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs index 537a50585e..2afe6a3f61 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs @@ -137,7 +137,7 @@ public abstract partial class SharedHandsSystem : EntitySystem return; } - _adminLogSystem.Add(LogType.Pickup, LogImpact.Low, $"{ToPrettyString(uid):user} picked up {ToPrettyString(entity):entity}"); + _adminLogger.Add(LogType.Pickup, LogImpact.Low, $"{ToPrettyString(uid):user} picked up {ToPrettyString(entity):entity}"); Dirty(hands); diff --git a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs index ae2a5bd863..824bc3eb1d 100644 --- a/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs +++ b/Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs @@ -11,7 +11,7 @@ namespace Content.Shared.Hands.EntitySystems; public abstract partial class SharedHandsSystem : EntitySystem { - [Dependency] private readonly SharedAdminLogSystem _adminLogSystem = default!; + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index aa2bae298b..be7fca2a1e 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -42,7 +42,7 @@ namespace Content.Shared.Interaction [Dependency] private readonly SharedPhysicsSystem _sharedBroadphaseSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly SharedVerbSystem _verbSystem = default!; - [Dependency] private readonly SharedAdminLogSystem _adminLogSystem = default!; + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly RotateToFaceSystem _rotateToFaceSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly UseDelaySystem _useDelay = default!; @@ -281,7 +281,7 @@ namespace Content.Shared.Interaction // all interactions should only happen when in range / unobstructed, so no range check is needed var message = new InteractHandEvent(user, target); RaiseLocalEvent(target, message); - _adminLogSystem.Add(LogType.InteractHand, LogImpact.Low, $"{ToPrettyString(user):user} interacted with {ToPrettyString(target):target}"); + _adminLogger.Add(LogType.InteractHand, LogImpact.Low, $"{ToPrettyString(user):user} interacted with {ToPrettyString(target):target}"); if (message.Handled) return; @@ -721,7 +721,7 @@ namespace Content.Shared.Interaction if (activateMsg.Handled) { _useDelay.BeginDelay(used, delayComponent); - _adminLogSystem.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user):user} activated {ToPrettyString(used):used}"); + _adminLogger.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user):user} activated {ToPrettyString(used):used}"); return true; } @@ -733,7 +733,7 @@ namespace Content.Shared.Interaction // No way to check success. _useDelay.BeginDelay(used, delayComponent); - _adminLogSystem.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user):user} activated {ToPrettyString(used):used}"); + _adminLogger.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user):user} activated {ToPrettyString(used):used}"); return true; } #endregion @@ -808,11 +808,11 @@ namespace Content.Shared.Interaction RaiseLocalEvent(thrown, throwMsg); if (throwMsg.Handled) { - _adminLogSystem.Add(LogType.Throw, LogImpact.Low,$"{ToPrettyString(user):user} threw {ToPrettyString(thrown):entity}"); + _adminLogger.Add(LogType.Throw, LogImpact.Low,$"{ToPrettyString(user):user} threw {ToPrettyString(thrown):entity}"); return; } - _adminLogSystem.Add(LogType.Throw, LogImpact.Low,$"{ToPrettyString(user):user} threw {ToPrettyString(thrown):entity}"); + _adminLogger.Add(LogType.Throw, LogImpact.Low,$"{ToPrettyString(user):user} threw {ToPrettyString(thrown):entity}"); } #endregion @@ -821,7 +821,7 @@ namespace Content.Shared.Interaction var dropMsg = new DroppedEvent(user); RaiseLocalEvent(item, dropMsg); if (dropMsg.Handled) - _adminLogSystem.Add(LogType.Drop, LogImpact.Low, $"{ToPrettyString(user):user} dropped {ToPrettyString(item):entity}"); + _adminLogger.Add(LogType.Drop, LogImpact.Low, $"{ToPrettyString(user):user} dropped {ToPrettyString(item):entity}"); Transform(item).LocalRotation = Angle.Zero; } #endregion diff --git a/Content.Shared/Slippery/SharedSlipperySystem.cs b/Content.Shared/Slippery/SharedSlipperySystem.cs index bf7c2c09dc..73a851e074 100644 --- a/Content.Shared/Slippery/SharedSlipperySystem.cs +++ b/Content.Shared/Slippery/SharedSlipperySystem.cs @@ -12,7 +12,7 @@ namespace Content.Shared.Slippery [UsedImplicitly] public abstract class SharedSlipperySystem : EntitySystem { - [Dependency] private readonly SharedAdminLogSystem _adminLog = default!; + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedStunSystem _stunSystem = default!; [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; [Dependency] private readonly SharedContainerSystem _container = default!; @@ -71,7 +71,7 @@ namespace Content.Shared.Slippery if (playSound) PlaySound(component); - _adminLog.Add(LogType.Slip, LogImpact.Low, + _adminLogger.Add(LogType.Slip, LogImpact.Low, $"{ToPrettyString(other):mob} slipped on collision with {ToPrettyString(component.Owner):entity}"); } diff --git a/Content.Shared/Throwing/ThrownItemSystem.cs b/Content.Shared/Throwing/ThrownItemSystem.cs index 8f4aa963f4..ae72e81e4f 100644 --- a/Content.Shared/Throwing/ThrownItemSystem.cs +++ b/Content.Shared/Throwing/ThrownItemSystem.cs @@ -17,7 +17,7 @@ namespace Content.Shared.Throwing public sealed class ThrownItemSystem : EntitySystem { [Dependency] private readonly SharedContainerSystem _containerSystem = default!; - [Dependency] private readonly SharedAdminLogSystem _adminLogSystem = default!; + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly FixtureSystem _fixtures = default!; private const string ThrowingFixture = "throw-fixture"; @@ -131,7 +131,7 @@ namespace Content.Shared.Throwing // Assume it's uninteresting if it has no thrower. For now anyway. if (thrownItem.Thrower is not null) - _adminLogSystem.Add(LogType.Landed, LogImpact.Low, $"{ToPrettyString(landing):entity} thrown by {ToPrettyString(thrownItem.Thrower.Value):thrower} landed."); + _adminLogger.Add(LogType.Landed, LogImpact.Low, $"{ToPrettyString(landing):entity} thrown by {ToPrettyString(thrownItem.Thrower.Value):thrower} landed."); var landMsg = new LandEvent {User = thrownItem.Thrower}; RaiseLocalEvent(landing, landMsg, false); @@ -143,7 +143,7 @@ namespace Content.Shared.Throwing public void ThrowCollideInteraction(EntityUid? user, IPhysBody thrown, IPhysBody target) { if (user is not null) - _adminLogSystem.Add(LogType.ThrowHit, LogImpact.Low, + _adminLogger.Add(LogType.ThrowHit, LogImpact.Low, $"{ToPrettyString(thrown.Owner):thrown} thrown by {ToPrettyString(user.Value):thrower} hit {ToPrettyString(target.Owner):target}."); // TODO: Just pass in the bodies directly RaiseLocalEvent(target.Owner, new ThrowHitByEvent(user, thrown.Owner, target.Owner));