Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow loglimits to be edited by plugins. #1721

Merged
merged 4 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MainModule/Server/Commands/Admins.luau
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ return function(Vargs, env)
})

local nlogs = #logs
if nlogs > 1000 then
if nlogs > Logs.OldCommandLogsLimit then
table.remove(logs, nlogs)
end

Expand Down
9 changes: 4 additions & 5 deletions MainModule/Server/Core/Logs.luau
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ return function(Vargs, GetEnv)
local service = Vargs.Service;
local DLL = server.DLL;

local MaxLogs = 1000
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings
local function Init()
Functions = server.Functions;
Expand All @@ -27,8 +26,7 @@ return function(Vargs, GetEnv)
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;

MaxLogs = Settings.MaxLogs;
Logs.MaxLogs = Settings.MaxLogs;

Logs.Init = nil;
Logs:AddLog("Script", "Logging Module Initialized");
Expand All @@ -47,6 +45,7 @@ return function(Vargs, GetEnv)
Exploit = if UseDLL then DLL.new() else {};
Errors = if UseDLL then DLL.new() else {};
DateTime = if UseDLL then DLL.new() else {};
MaxLogs = 1000;
TempUpdaters = {};
OldCommandLogsLimit = 1000; --// Maximum number of command logs to save to the datastore (the higher the number, the longer the server will take to close)

Expand Down Expand Up @@ -91,10 +90,10 @@ return function(Vargs, GetEnv)
end

if tab.__meta == "DLL" then
tab:AddToStartAndRemoveEndIfEnd(log, MaxLogs)
tab:AddToStartAndRemoveEndIfEnd(log, Logs.MaxLogs)
else
table.insert(tab, 1, log)
if #tab > tonumber(MaxLogs) then
if #tab > tonumber(Logs.MaxLogs) then
table.remove(tab, #tab)
end
end
Expand Down
2 changes: 1 addition & 1 deletion MainModule/Server/Plugins/Server-SoftShutdown.luau
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ return function(Vargs, GetEnv)
})
end

if #logs > 1000 then
if #logs > Logs.OldCommandLogsLimit then
table.remove(logs, #logs)
end

Expand Down
Loading