[PRIORITY NEGATIVE ONE/STABLE HOTFIX] ADMIN NOTES CANNOT BE ACCESSED (#40863)

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Fix logger obsolete warnings (#40553)"
This commit is contained in:
Princess Cheeseballs
2025-10-12 14:52:26 -07:00
committed by GitHub
parent 9877b77fff
commit e917c8e067
10 changed files with 22 additions and 63 deletions

View File

@@ -14,9 +14,6 @@ namespace Content.Client.Administration.UI.Notes;
[GenerateTypedNameReferences] [GenerateTypedNameReferences]
public sealed partial class AdminNotesLine : BoxContainer public sealed partial class AdminNotesLine : BoxContainer
{ {
[Dependency] private readonly ILogManager _logManager = default!;
private readonly ISawmill _sawmill = default!;
private readonly SpriteSystem _sprites; private readonly SpriteSystem _sprites;
private const string AdminNotesTextureBase = "/Textures/Interface/AdminNotes/"; private const string AdminNotesTextureBase = "/Textures/Interface/AdminNotes/";
@@ -36,8 +33,6 @@ public sealed partial class AdminNotesLine : BoxContainer
public AdminNotesLine(SpriteSystem sprites, SharedAdminNote note) public AdminNotesLine(SpriteSystem sprites, SharedAdminNote note)
{ {
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
_sawmill = _logManager.GetSawmill("admin.notes");
_sprites = sprites; _sprites = sprites;
Note = note; Note = note;
@@ -66,7 +61,7 @@ public sealed partial class AdminNotesLine : BoxContainer
if (iconPath is null) if (iconPath is null)
{ {
SeverityRect.Visible = false; SeverityRect.Visible = false;
_sawmill.Warning($"Could not find an icon for note ID {Note.Id}"); Logger.WarningS("admin.notes", $"Could not find an icon for note ID {Note.Id}");
} }
else else
{ {

View File

@@ -30,10 +30,8 @@ namespace Content.Client.Construction.UI
[Dependency] private readonly IUserInterfaceManager _uiManager = default!; [Dependency] private readonly IUserInterfaceManager _uiManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IClientPreferencesManager _preferencesManager = default!; [Dependency] private readonly IClientPreferencesManager _preferencesManager = default!;
[Dependency] private readonly ILogManager _logManager = default!;
private readonly ISawmill _sawmill = default!;
private readonly SpriteSystem _spriteSystem; private readonly SpriteSystem _spriteSystem;
private readonly IConstructionMenuView _constructionView; private readonly IConstructionMenuView _constructionView;
private readonly EntityWhitelistSystem _whitelistSystem; private readonly EntityWhitelistSystem _whitelistSystem;
@@ -89,8 +87,6 @@ namespace Content.Client.Construction.UI
{ {
// This is a lot easier than a factory // This is a lot easier than a factory
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
_sawmill = _logManager.GetSawmill("construction.menu");
_constructionView = new ConstructionMenu(); _constructionView = new ConstructionMenu();
_whitelistSystem = _entManager.System<EntityWhitelistSystem>(); _whitelistSystem = _entManager.System<EntityWhitelistSystem>();
_spriteSystem = _entManager.System<SpriteSystem>(); _spriteSystem = _entManager.System<SpriteSystem>();
@@ -288,7 +284,7 @@ namespace Content.Client.Construction.UI
if (!_constructionSystem!.TryGetRecipePrototype(recipe.ID, out var targetProtoId)) if (!_constructionSystem!.TryGetRecipePrototype(recipe.ID, out var targetProtoId))
{ {
_sawmill.Error("Cannot find the target prototype in the recipe cache with the id \"{0}\" of {1}.", Logger.Error("Cannot find the target prototype in the recipe cache with the id \"{0}\" of {1}.",
recipe.ID, recipe.ID,
nameof(ConstructionPrototype)); nameof(ConstructionPrototype));
continue; continue;

View File

@@ -7,6 +7,7 @@ using Robust.Client.UserInterface;
using Robust.Shared.ContentPack; using Robust.Shared.ContentPack;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Reflection; using Robust.Shared.Reflection;
using Robust.Shared.Sandboxing;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using static Pidgin.Parser; using static Pidgin.Parser;
@@ -20,7 +21,7 @@ public sealed partial class DocumentParsingManager
[Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IReflectionManager _reflectionManager = default!; [Dependency] private readonly IReflectionManager _reflectionManager = default!;
[Dependency] private readonly IResourceManager _resourceManager = default!; [Dependency] private readonly IResourceManager _resourceManager = default!;
[Dependency] private readonly IDynamicTypeFactory _dynamicTypeFactory = default!; [Dependency] private readonly ISandboxHelper _sandboxHelper = default!;
private readonly Dictionary<string, Parser<char, Control>> _tagControlParsers = new(); private readonly Dictionary<string, Parser<char, Control>> _tagControlParsers = new();
private Parser<char, Control> _controlParser = default!; private Parser<char, Control> _controlParser = default!;
@@ -42,7 +43,7 @@ public sealed partial class DocumentParsingManager
foreach (var typ in _reflectionManager.GetAllChildren<IDocumentTag>()) foreach (var typ in _reflectionManager.GetAllChildren<IDocumentTag>())
{ {
_tagControlParsers.Add(typ.Name, CreateTagControlParser(typ.Name, typ, _dynamicTypeFactory)); _tagControlParsers.Add(typ.Name, CreateTagControlParser(typ.Name, typ, _sandboxHelper));
} }
ControlParser = whitespaceAndCommentParser.Then(_controlParser.Many()); ControlParser = whitespaceAndCommentParser.Then(_controlParser.Many());
@@ -86,14 +87,14 @@ public sealed partial class DocumentParsingManager
return true; return true;
} }
private Parser<char, Control> CreateTagControlParser(string tagId, Type tagType, IDynamicTypeFactory typeFactory) private Parser<char, Control> CreateTagControlParser(string tagId, Type tagType, ISandboxHelper sandbox)
{ {
return Map( return Map(
(args, controls) => (args, controls) =>
{ {
try try
{ {
var tag = (IDocumentTag) typeFactory.CreateInstance(tagType); var tag = (IDocumentTag) sandbox.CreateInstance(tagType);
if (!tag.TryParseTag(args, out var control)) if (!tag.TryParseTag(args, out var control))
{ {
_sawmill.Error($"Failed to parse {tagId} args"); _sawmill.Error($"Failed to parse {tagId} args");

View File

@@ -8,11 +8,6 @@ namespace Content.Client.Guidebook.Richtext;
[UsedImplicitly] [UsedImplicitly]
public sealed class Table : TableContainer, IDocumentTag public sealed class Table : TableContainer, IDocumentTag
{ {
[Dependency] private readonly ILogManager _logManager = default!;
private ISawmill Sawmill => _sawmill ??= _logManager.GetSawmill("table");
private ISawmill? _sawmill;
public bool TryParseTag(Dictionary<string, string> args, [NotNullWhen(true)] out Control? control) public bool TryParseTag(Dictionary<string, string> args, [NotNullWhen(true)] out Control? control)
{ {
HorizontalExpand = true; HorizontalExpand = true;
@@ -20,7 +15,7 @@ public sealed class Table : TableContainer, IDocumentTag
if (!args.TryGetValue("Columns", out var columns) || !int.TryParse(columns, out var columnsCount)) if (!args.TryGetValue("Columns", out var columns) || !int.TryParse(columns, out var columnsCount))
{ {
Sawmill.Error("Guidebook tag \"Table\" does not specify required property \"Columns.\""); Logger.Error("Guidebook tag \"Table\" does not specify required property \"Columns.\"");
control = null; control = null;
return false; return false;
} }

View File

@@ -1,4 +1,4 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
@@ -12,11 +12,6 @@ namespace Content.Client.Guidebook.RichText;
[UsedImplicitly] [UsedImplicitly]
public sealed class TextLinkTag : IMarkupTagHandler public sealed class TextLinkTag : IMarkupTagHandler
{ {
[Dependency] private readonly ILogManager _logManager = default!;
private ISawmill Sawmill => _sawmill ??= _logManager.GetSawmill(Name);
private ISawmill? _sawmill;
public static Color LinkColor => Color.CornflowerBlue; public static Color LinkColor => Color.CornflowerBlue;
public string Name => "textlink"; public string Name => "textlink";
@@ -58,7 +53,7 @@ public sealed class TextLinkTag : IMarkupTagHandler
if (control.TryGetParentHandler<ILinkClickHandler>(out var handler)) if (control.TryGetParentHandler<ILinkClickHandler>(out var handler))
handler.HandleClick(link); handler.HandleClick(link);
else else
Sawmill.Warning("Warning! No valid ILinkClickHandler found."); Logger.Warning("Warning! No valid ILinkClickHandler found.");
} }
} }

View File

@@ -20,9 +20,7 @@ namespace Content.Client.Launcher
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!; [Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IClipboardManager _clipboard = default!; [Dependency] private readonly IClipboardManager _clipboard = default!;
[Dependency] private readonly ILogManager _logManager = default!;
private ISawmill _sawmill = default!;
private LauncherConnectingGui? _control; private LauncherConnectingGui? _control;
private Page _currentPage; private Page _currentPage;
@@ -61,8 +59,6 @@ namespace Content.Client.Launcher
protected override void Startup() protected override void Startup()
{ {
_sawmill = _logManager.GetSawmill("launcher-ui");
_control = new LauncherConnectingGui(this, _random, _prototypeManager, _cfg, _clipboard); _control = new LauncherConnectingGui(this, _random, _prototypeManager, _cfg, _clipboard);
_userInterfaceManager.StateRoot.AddChild(_control); _userInterfaceManager.StateRoot.AddChild(_control);
@@ -119,12 +115,12 @@ namespace Content.Client.Launcher
} }
else else
{ {
_sawmill.Info($"Redial not possible, no Ss14Address"); Logger.InfoS("launcher-ui", $"Redial not possible, no Ss14Address");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
_sawmill.Error($"Redial exception: {ex}"); Logger.ErrorS("launcher-ui", $"Redial exception: {ex}");
} }
return false; return false;
} }

View File

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

View File

@@ -33,9 +33,7 @@ public sealed class ReplayMainScreen : State
[Dependency] private readonly IClientRobustSerializer _serializer = default!; [Dependency] private readonly IClientRobustSerializer _serializer = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly ContentReplayPlaybackManager _replayMan = default!; [Dependency] private readonly ContentReplayPlaybackManager _replayMan = default!;
[Dependency] private readonly ILogManager _logManager = default!;
private ISawmill _sawmill = default!;
private ReplayMainMenuControl _mainMenuControl = default!; private ReplayMainMenuControl _mainMenuControl = default!;
private SelectReplayWindow? _selectWindow; private SelectReplayWindow? _selectWindow;
private ResPath _directory; private ResPath _directory;
@@ -44,8 +42,6 @@ public sealed class ReplayMainScreen : State
protected override void Startup() protected override void Startup()
{ {
_sawmill = _logManager.GetSawmill("replay.screen");
_mainMenuControl = new(_resourceCache); _mainMenuControl = new(_resourceCache);
_userInterfaceManager.StateRoot.AddChild(_mainMenuControl); _userInterfaceManager.StateRoot.AddChild(_mainMenuControl);
@@ -267,7 +263,7 @@ public sealed class ReplayMainScreen : State
} }
catch (Exception ex) catch (Exception ex)
{ {
_sawmill.Error($"Failed to load replay info. Exception: {ex}"); Logger.Error($"Failed to load replay info. Exception: {ex}");
SelectReplay(null); SelectReplay(null);
return; return;
} }

View File

@@ -1,3 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.Administration.Managers; using Content.Server.Administration.Managers;
using Content.Server.Administration.Systems; using Content.Server.Administration.Systems;
@@ -15,9 +18,6 @@ using Robust.Shared.Network;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Replays; using Robust.Shared.Replays;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
namespace Content.Server.Chat.Managers; namespace Content.Server.Chat.Managers;
@@ -45,7 +45,6 @@ internal sealed partial class ChatManager : IChatManager
[Dependency] private readonly PlayerRateLimitManager _rateLimitManager = default!; [Dependency] private readonly PlayerRateLimitManager _rateLimitManager = default!;
[Dependency] private readonly ISharedPlayerManager _player = default!; [Dependency] private readonly ISharedPlayerManager _player = default!;
[Dependency] private readonly DiscordChatLink _discordLink = default!; [Dependency] private readonly DiscordChatLink _discordLink = default!;
[Dependency] private readonly ILogManager _logManager = default!;
/// <summary> /// <summary>
/// The maximum length a player-sent message can be sent /// The maximum length a player-sent message can be sent
@@ -55,7 +54,6 @@ internal sealed partial class ChatManager : IChatManager
private bool _oocEnabled = true; private bool _oocEnabled = true;
private bool _adminOocEnabled = true; private bool _adminOocEnabled = true;
private ISawmill _sawmill = default!;
private readonly Dictionary<NetUserId, ChatUser> _players = new(); private readonly Dictionary<NetUserId, ChatUser> _players = new();
public void Initialize() public void Initialize()
@@ -66,8 +64,6 @@ internal sealed partial class ChatManager : IChatManager
_configurationManager.OnValueChanged(CCVars.OocEnabled, OnOocEnabledChanged, true); _configurationManager.OnValueChanged(CCVars.OocEnabled, OnOocEnabledChanged, true);
_configurationManager.OnValueChanged(CCVars.AdminOocEnabled, OnAdminOocEnabledChanged, true); _configurationManager.OnValueChanged(CCVars.AdminOocEnabled, OnAdminOocEnabledChanged, true);
_sawmill = _logManager.GetSawmill("SERVER");
RegisterRateLimits(); RegisterRateLimits();
} }
@@ -115,7 +111,7 @@ internal sealed partial class ChatManager : IChatManager
{ {
var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", FormattedMessage.EscapeText(message))); var wrappedMessage = Loc.GetString("chat-manager-server-wrap-message", ("message", FormattedMessage.EscapeText(message)));
ChatMessageToAll(ChatChannel.Server, message, wrappedMessage, EntityUid.Invalid, hideChat: false, recordReplay: true, colorOverride: colorOverride); ChatMessageToAll(ChatChannel.Server, message, wrappedMessage, EntityUid.Invalid, hideChat: false, recordReplay: true, colorOverride: colorOverride);
_sawmill.Info(message); Logger.InfoS("SERVER", message);
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server announcement: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server announcement: {message}");
} }

View File

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