(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

@@ -13,11 +13,14 @@ namespace Content.Server.GameTicking.Commands
[AnyCommand]
sealed class JoinGameCommand : IConsoleCommand
{
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
private readonly ISawmill _sawmill = default!;
public string Command => "joingame";
public string Description => "";
public string Help => "";
@@ -25,6 +28,8 @@ namespace Content.Server.GameTicking.Commands
public JoinGameCommand()
{
IoCManager.InjectDependencies(this);
_sawmill = _logManager.GetSawmill("security");
}
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
@@ -46,7 +51,7 @@ namespace Content.Server.GameTicking.Commands
if (ticker.PlayerGameStatuses.TryGetValue(player.UserId, out var status) && status == PlayerGameStatus.JoinedGame)
{
Logger.InfoS("security", $"{player.Name} ({player.UserId}) attempted to latejoin while in-game.");
_sawmill.Info($"{player.Name} ({player.UserId}) attempted to latejoin while in-game.");
shell.WriteError($"{player.Name} is not in the lobby. This incident will be reported.");
return;
}