[GenerateTypedNameReferences]
public sealed partial class AdminNotesLine : BoxContainer
{
+ [Dependency] private readonly ILogManager _logManager = default!;
+
+ private readonly ISawmill _sawmill = default!;
private readonly SpriteSystem _sprites;
private const string AdminNotesTextureBase = "/Textures/Interface/AdminNotes/";
public AdminNotesLine(SpriteSystem sprites, SharedAdminNote note)
{
RobustXamlLoader.Load(this);
+
+ _sawmill = _logManager.GetSawmill("admin.notes");
_sprites = sprites;
Note = note;
if (iconPath is null)
{
SeverityRect.Visible = false;
- Logger.WarningS("admin.notes", $"Could not find an icon for note ID {Note.Id}");
+ _sawmill.Warning($"Could not find an icon for note ID {Note.Id}");
}
else
{
[Dependency] private readonly IUserInterfaceManager _uiManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IClientPreferencesManager _preferencesManager = default!;
- private readonly SpriteSystem _spriteSystem;
+ [Dependency] private readonly ILogManager _logManager = default!;
+ private readonly ISawmill _sawmill = default!;
+ private readonly SpriteSystem _spriteSystem;
private readonly IConstructionMenuView _constructionView;
private readonly EntityWhitelistSystem _whitelistSystem;
{
// This is a lot easier than a factory
IoCManager.InjectDependencies(this);
+ _sawmill = _logManager.GetSawmill("construction.menu");
+
_constructionView = new ConstructionMenu();
_whitelistSystem = _entManager.System<EntityWhitelistSystem>();
_spriteSystem = _entManager.System<SpriteSystem>();
if (!_constructionSystem!.TryGetRecipePrototype(recipe.ID, out var targetProtoId))
{
- Logger.Error("Cannot find the target prototype in the recipe cache with the id \"{0}\" of {1}.",
+ _sawmill.Error("Cannot find the target prototype in the recipe cache with the id \"{0}\" of {1}.",
recipe.ID,
nameof(ConstructionPrototype));
continue;
using Robust.Shared.ContentPack;
using Robust.Shared.Prototypes;
using Robust.Shared.Reflection;
-using Robust.Shared.Sandboxing;
using Robust.Shared.Utility;
using static Pidgin.Parser;
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IReflectionManager _reflectionManager = default!;
[Dependency] private readonly IResourceManager _resourceManager = default!;
- [Dependency] private readonly ISandboxHelper _sandboxHelper = default!;
+ [Dependency] private readonly IDynamicTypeFactory _dynamicTypeFactory = default!;
private readonly Dictionary<string, Parser<char, Control>> _tagControlParsers = new();
private Parser<char, Control> _controlParser = default!;
foreach (var typ in _reflectionManager.GetAllChildren<IDocumentTag>())
{
- _tagControlParsers.Add(typ.Name, CreateTagControlParser(typ.Name, typ, _sandboxHelper));
+ _tagControlParsers.Add(typ.Name, CreateTagControlParser(typ.Name, typ, _dynamicTypeFactory));
}
ControlParser = whitespaceAndCommentParser.Then(_controlParser.Many());
return true;
}
- private Parser<char, Control> CreateTagControlParser(string tagId, Type tagType, ISandboxHelper sandbox)
+ private Parser<char, Control> CreateTagControlParser(string tagId, Type tagType, IDynamicTypeFactory typeFactory)
{
return Map(
(args, controls) =>
{
try
{
- var tag = (IDocumentTag) sandbox.CreateInstance(tagType);
+ var tag = (IDocumentTag) typeFactory.CreateInstance(tagType);
if (!tag.TryParseTag(args, out var control))
{
_sawmill.Error($"Failed to parse {tagId} args");
[UsedImplicitly]
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)
{
HorizontalExpand = true;
if (!args.TryGetValue("Columns", out var columns) || !int.TryParse(columns, out var columnsCount))
{
- Logger.Error("Guidebook tag \"Table\" does not specify required property \"Columns.\"");
+ Sawmill.Error("Guidebook tag \"Table\" does not specify required property \"Columns.\"");
control = null;
return false;
}
-using System.Diagnostics.CodeAnalysis;
+using System.Diagnostics.CodeAnalysis;
using JetBrains.Annotations;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
[UsedImplicitly]
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 string Name => "textlink";
if (control.TryGetParentHandler<ILinkClickHandler>(out var handler))
handler.HandleClick(link);
else
- Logger.Warning("Warning! No valid ILinkClickHandler found.");
+ Sawmill.Warning("Warning! No valid ILinkClickHandler found.");
}
}
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IClipboardManager _clipboard = default!;
+ [Dependency] private readonly ILogManager _logManager = default!;
+ private ISawmill _sawmill = default!;
private LauncherConnectingGui? _control;
private Page _currentPage;
protected override void Startup()
{
+ _sawmill = _logManager.GetSawmill("launcher-ui");
+
_control = new LauncherConnectingGui(this, _random, _prototypeManager, _cfg, _clipboard);
_userInterfaceManager.StateRoot.AddChild(_control);
}
else
{
- Logger.InfoS("launcher-ui", $"Redial not possible, no Ss14Address");
+ _sawmill.Info($"Redial not possible, no Ss14Address");
}
}
catch (Exception ex)
{
- Logger.ErrorS("launcher-ui", $"Redial exception: {ex}");
+ _sawmill.Error($"Redial exception: {ex}");
}
return false;
}
[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,
{
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;
}
[Dependency] private readonly IClientRobustSerializer _serializer = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly ContentReplayPlaybackManager _replayMan = default!;
+ [Dependency] private readonly ILogManager _logManager = default!;
+ private ISawmill _sawmill = default!;
private ReplayMainMenuControl _mainMenuControl = default!;
private SelectReplayWindow? _selectWindow;
private ResPath _directory;
protected override void Startup()
{
+ _sawmill = _logManager.GetSawmill("replay.screen");
+
_mainMenuControl = new(_resourceCache);
_userInterfaceManager.StateRoot.AddChild(_mainMenuControl);
}
catch (Exception ex)
{
- Logger.Error($"Failed to load replay info. Exception: {ex}");
+ _sawmill.Error($"Failed to load replay info. Exception: {ex}");
SelectReplay(null);
return;
}
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Runtime.InteropServices;
using Content.Server.Administration.Logs;
using Content.Server.Administration.Managers;
using Content.Server.Administration.Systems;
using Robust.Shared.Player;
using Robust.Shared.Replays;
using Robust.Shared.Utility;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using System.Runtime.InteropServices;
namespace Content.Server.Chat.Managers;
[Dependency] private readonly PlayerRateLimitManager _rateLimitManager = default!;
[Dependency] private readonly ISharedPlayerManager _player = default!;
[Dependency] private readonly DiscordChatLink _discordLink = default!;
+ [Dependency] private readonly ILogManager _logManager = default!;
/// <summary>
/// The maximum length a player-sent message can be sent
private bool _oocEnabled = true;
private bool _adminOocEnabled = true;
+ private ISawmill _sawmill = default!;
private readonly Dictionary<NetUserId, ChatUser> _players = new();
public void Initialize()
_configurationManager.OnValueChanged(CCVars.OocEnabled, OnOocEnabledChanged, true);
_configurationManager.OnValueChanged(CCVars.AdminOocEnabled, OnAdminOocEnabledChanged, true);
+ _sawmill = _logManager.GetSawmill("SERVER");
+
RegisterRateLimits();
}
{
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);
- Logger.InfoS("SERVER", message);
+ _sawmill.Info(message);
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server announcement: {message}");
}
[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 => "";
public JoinGameCommand()
{
IoCManager.InjectDependencies(this);
+
+ _sawmill = _logManager.GetSawmill("security");
}
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
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;
}