(Cleanup) Fix logger obsolete warnings (#40553)

* Switched obsolete logger usages to use Sawmill

Fix the majority of obsolete logger usages outside the engine code.

* Fix injection in ChatManager and revert BuildMech changes

* Removed extra manual injection

* Reduced extra static injection and reverted changes to CommandButton as it needs engine changes.

* Removed two more cases of double injection and an extra using

* Reverted changes for Inventory Display

* Moved sawmill setup outside constructor in Table to resolve test failure
This commit is contained in:
David
2025-10-07 05:45:01 -06:00
committed by GitHub
parent 101b9ffb25
commit 691ca31b95
10 changed files with 63 additions and 22 deletions

View File

@@ -14,12 +14,18 @@ namespace Content.Client.UserInterface.Systems.Alerts.Widgets;
[GenerateTypedNameReferences]
public sealed partial class AlertsUI : UIWidget
{
[Dependency] private readonly ILogManager _logManager = default!;
private readonly ISawmill _sawmill = default!;
// also known as Control.Children?
private readonly Dictionary<AlertKey, AlertControl> _alertControls = new();
public AlertsUI()
{
RobustXamlLoader.Load(this);
_sawmill = _logManager.GetSawmill("alertsui");
}
public void SyncControls(AlertsSystem alertsSystem,
@@ -78,15 +84,15 @@ public sealed partial class AlertsUI : UIWidget
{
if (!alertKey.AlertType.HasValue)
{
Logger.WarningS("alert", "found alertkey without alerttype," +
" alert keys should never be stored without an alerttype set: {0}", alertKey);
_sawmill.Warning("found alertkey without alerttype," +
" alert keys should never be stored without an alerttype set: {0}", alertKey);
continue;
}
var alertType = alertKey.AlertType.Value;
if (!alertsSystem.TryGet(alertType, out var newAlert))
{
Logger.ErrorS("alert", "Unrecognized alertType {0}", alertType);
_sawmill.Error("Unrecognized alertType {0}", alertType);
continue;
}