Cleanup some easy-to-fix static logger warnings (#37820)
This commit is contained in:
@@ -16,6 +16,9 @@ public sealed class DepartmentBanCommand : IConsoleCommand
|
||||
[Dependency] private readonly IPlayerLocator _locator = default!;
|
||||
[Dependency] private readonly IBanManager _banManager = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
[Dependency] private readonly ILogManager _log = default!;
|
||||
|
||||
private ISawmill? _sawmill;
|
||||
|
||||
public string Command => "departmentban";
|
||||
public string Description => Loc.GetString("cmd-departmentban-desc");
|
||||
@@ -29,7 +32,8 @@ public sealed class DepartmentBanCommand : IConsoleCommand
|
||||
uint minutes;
|
||||
if (!Enum.TryParse(_cfg.GetCVar(CCVars.DepartmentBanDefaultSeverity), out NoteSeverity severity))
|
||||
{
|
||||
Logger.WarningS("admin.department_ban", "Department ban severity could not be parsed from config! Defaulting to medium.");
|
||||
_sawmill ??= _log.GetSawmill("admin.department_ban");
|
||||
_sawmill.Warning("Department ban severity could not be parsed from config! Defaulting to medium.");
|
||||
severity = NoteSeverity.Medium;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,11 @@ public sealed class RoleBanCommand : IConsoleCommand
|
||||
[Dependency] private readonly IPlayerLocator _locator = default!;
|
||||
[Dependency] private readonly IBanManager _bans = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
[Dependency] private readonly ILogManager _log = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
|
||||
private ISawmill? _sawmill;
|
||||
|
||||
public string Command => "roleban";
|
||||
public string Description => Loc.GetString("cmd-roleban-desc");
|
||||
public string Help => Loc.GetString("cmd-roleban-help");
|
||||
@@ -31,7 +34,8 @@ public sealed class RoleBanCommand : IConsoleCommand
|
||||
uint minutes;
|
||||
if (!Enum.TryParse(_cfg.GetCVar(CCVars.RoleBanDefaultSeverity), out NoteSeverity severity))
|
||||
{
|
||||
Logger.WarningS("admin.role_ban", "Role ban severity could not be parsed from config! Defaulting to medium.");
|
||||
_sawmill ??= _log.GetSawmill("admin.role_ban");
|
||||
_sawmill.Warning("Role ban severity could not be parsed from config! Defaulting to medium.");
|
||||
severity = NoteSeverity.Medium;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,16 +13,19 @@ public sealed class UserNotesEui : BaseEui
|
||||
{
|
||||
[Dependency] private readonly IAdminNotesManager _notesMan = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
[Dependency] private readonly ILogManager _log = default!;
|
||||
private readonly bool _seeOwnNotes;
|
||||
private readonly ISawmill _sawmill;
|
||||
|
||||
public UserNotesEui()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_sawmill = _log.GetSawmill("admin.notes");
|
||||
_seeOwnNotes = _cfg.GetCVar(CCVars.SeeOwnNotes);
|
||||
|
||||
if (!_seeOwnNotes)
|
||||
{
|
||||
Logger.WarningS("admin.notes", "User notes initialized when see_own_notes set to false");
|
||||
_sawmill.Warning("User notes initialized when see_own_notes set to false");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +42,7 @@ public sealed class UserNotesEui : BaseEui
|
||||
{
|
||||
if (!_seeOwnNotes)
|
||||
{
|
||||
Logger.WarningS("admin.notes", $"User {Player.Name} with ID {Player.UserId} tried to update their own user notes when see_own_notes was set to false");
|
||||
_sawmill.Warning($"User {Player.Name} with ID {Player.UserId} tried to update their own user notes when see_own_notes was set to false");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,12 @@ namespace Content.Server.EUI
|
||||
{
|
||||
public sealed class EuiManager : IPostInjectInit
|
||||
{
|
||||
[Dependency] private readonly ILogManager _log = default!;
|
||||
[Dependency] private readonly IPlayerManager _players = default!;
|
||||
[Dependency] private readonly IServerNetManager _net = default!;
|
||||
|
||||
private ISawmill? _sawmill;
|
||||
|
||||
private readonly Dictionary<ICommonSession, PlayerEuiData> _playerData =
|
||||
new();
|
||||
|
||||
@@ -34,6 +37,7 @@ namespace Content.Server.EUI
|
||||
_net.RegisterNetMessage<MsgEuiCtl>();
|
||||
_net.RegisterNetMessage<MsgEuiState>();
|
||||
_net.RegisterNetMessage<MsgEuiMessage>(RxMsgMessage);
|
||||
_sawmill = _log.GetSawmill("eui");
|
||||
}
|
||||
|
||||
public void SendUpdates()
|
||||
@@ -99,7 +103,7 @@ namespace Content.Server.EUI
|
||||
|
||||
if (!dat.OpenUIs.TryGetValue(message.Id, out var eui))
|
||||
{
|
||||
Logger.WarningS("eui", $"Got EUI message from player {ply} for non-existing UI {message.Id}");
|
||||
_sawmill?.Warning($"Got EUI message from player {ply} for non-existing UI {message.Id}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Content.Server.Preferences.Managers
|
||||
|
||||
if (!_cachedPlayerPrefs.TryGetValue(userId, out var prefsData) || !prefsData.PrefsLoaded)
|
||||
{
|
||||
Logger.WarningS("prefs", $"User {userId} tried to modify preferences before they loaded.");
|
||||
_sawmill.Warning($"User {userId} tried to modify preferences before they loaded.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace Content.Server.Preferences.Managers
|
||||
|
||||
if (!_cachedPlayerPrefs.TryGetValue(userId, out var prefsData) || !prefsData.PrefsLoaded)
|
||||
{
|
||||
Logger.WarningS("prefs", $"User {userId} tried to modify preferences before they loaded.");
|
||||
_sawmill.Warning($"User {userId} tried to modify preferences before they loaded.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user