Add CCVar to enable and disable admin logs
This commit is contained in:
@@ -64,6 +64,7 @@ public partial class AdminLogSystem : SharedAdminLogSystem
|
|||||||
|
|
||||||
// CVars
|
// CVars
|
||||||
private bool _metricsEnabled;
|
private bool _metricsEnabled;
|
||||||
|
private bool _enabled;
|
||||||
private TimeSpan _queueSendDelay;
|
private TimeSpan _queueSendDelay;
|
||||||
private int _queueMax;
|
private int _queueMax;
|
||||||
private int _preRoundQueueMax;
|
private int _preRoundQueueMax;
|
||||||
@@ -85,6 +86,8 @@ public partial class AdminLogSystem : SharedAdminLogSystem
|
|||||||
|
|
||||||
_configuration.OnValueChanged(CVars.MetricsEnabled,
|
_configuration.OnValueChanged(CVars.MetricsEnabled,
|
||||||
value => _metricsEnabled = value, true);
|
value => _metricsEnabled = value, true);
|
||||||
|
_configuration.OnValueChanged(CCVars.AdminLogsEnabled,
|
||||||
|
value => _enabled = value, true);
|
||||||
_configuration.OnValueChanged(CCVars.AdminLogsQueueSendDelay,
|
_configuration.OnValueChanged(CCVars.AdminLogsQueueSendDelay,
|
||||||
value => _queueSendDelay = TimeSpan.FromSeconds(value), true);
|
value => _queueSendDelay = TimeSpan.FromSeconds(value), true);
|
||||||
_configuration.OnValueChanged(CCVars.AdminLogsQueueMax,
|
_configuration.OnValueChanged(CCVars.AdminLogsQueueMax,
|
||||||
@@ -268,6 +271,12 @@ public partial class AdminLogSystem : SharedAdminLogSystem
|
|||||||
|
|
||||||
public override void Add(LogType type, LogImpact impact, ref LogStringHandler handler)
|
public override void Add(LogType type, LogImpact impact, ref LogStringHandler handler)
|
||||||
{
|
{
|
||||||
|
if (!_enabled)
|
||||||
|
{
|
||||||
|
handler.ToStringAndClear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var (json, players, entities) = ToJson(handler.Values);
|
var (json, players, entities) = ToJson(handler.Values);
|
||||||
var message = handler.ToStringAndClear();
|
var message = handler.ToStringAndClear();
|
||||||
|
|
||||||
|
|||||||
@@ -298,6 +298,9 @@ namespace Content.Shared.CCVar
|
|||||||
* Admin logs
|
* Admin logs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public static readonly CVarDef<bool> AdminLogsEnabled =
|
||||||
|
CVarDef.Create("adminlogs.enabled", true, CVar.SERVERONLY);
|
||||||
|
|
||||||
public static readonly CVarDef<float> AdminLogsQueueSendDelay =
|
public static readonly CVarDef<float> AdminLogsQueueSendDelay =
|
||||||
CVarDef.Create("adminlogs.queue_send_delay_seconds", 5f, CVar.SERVERONLY);
|
CVarDef.Create("adminlogs.queue_send_delay_seconds", 5f, CVar.SERVERONLY);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user