From 45ce828a168a96783c4c96bd18c3b3d5a3bfeee4 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 1 Jan 2017 22:44:13 +0100 Subject: Debuggers: PluginStats are now output only on request. (#3513) The stats are no longer output on plugin startup, instead there is a new console command "pluginstats" for that. --- Server/Plugins/Debuggers/Debuggers.lua | 66 ++++++++-------------------------- 1 file changed, 15 insertions(+), 51 deletions(-) (limited to 'Server/Plugins/Debuggers/Debuggers.lua') diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua index 8e2bd0156..28b7e254d 100644 --- a/Server/Plugins/Debuggers/Debuggers.lua +++ b/Server/Plugins/Debuggers/Debuggers.lua @@ -54,7 +54,6 @@ function Initialize(a_Plugin) -- TestBlockAreas() -- TestSQLiteBindings() -- TestExpatBindings() - TestPluginCalls() TestBlockAreasString() TestStringBase64() @@ -62,10 +61,6 @@ function Initialize(a_Plugin) -- TestRankMgr() TestFileExt() -- TestFileLastMod() - TestPluginInterface() - - local LastSelfMod = cFile:GetLastModificationTime(a_Plugin:GetLocalFolder() .. "/Debuggers.lua") - LOG("Debuggers.lua last modified on " .. os.date("%Y-%m-%dT%H:%M:%S", LastSelfMod)) --[[ -- Test cCompositeChat usage in console-logging: @@ -95,27 +90,6 @@ end; -function TestPluginInterface() - cPluginManager:DoWithPlugin("Core", - function (a_CBPlugin) - if (a_CBPlugin:GetStatus() == cPluginManager.psLoaded) then - LOG("Core plugin was found, version " .. a_CBPlugin:GetVersion()) - else - LOG("Core plugin is not loaded") - end - end - ) - - cPluginManager:ForEachPlugin( - function (a_CBPlugin) - LOG("Plugin in " .. a_CBPlugin:GetFolderName() .. " has an API name of " .. a_CBPlugin:GetName() .. " and status " .. a_CBPlugin:GetStatus()) - end - ) -end - - - - function TestFileExt() assert(cFile:ChangeFileExt("fileless_dir/", "new") == "fileless_dir/") assert(cFile:ChangeFileExt("fileless_dir/", ".new") == "fileless_dir/") @@ -138,6 +112,9 @@ end function TestFileLastMod() + local LastSelfMod = cFile:GetLastModificationTime(a_Plugin:GetLocalFolder() .. "/Debuggers.lua") + LOG("Debuggers.lua last modified on " .. os.date("%Y-%m-%dT%H:%M:%S", LastSelfMod)) + local f = assert(io.open("test.txt", "w")) f:write("test") f:close() @@ -150,31 +127,6 @@ end -function TestPluginCalls() - -- In order to test the inter-plugin communication, we're going to call Core's ReturnColorFromChar() function - -- It is a rather simple function that doesn't need any tables as its params and returns a value, too - -- Note the signature: function ReturnColorFromChar( Split, char ) ... return cChatColog.Gray ... end - -- The Split parameter should be a table, but it is not used in that function anyway, - -- so we can get away with passing nil to it. - - LOG("Debuggers: Calling NoSuchPlugin.FnName()...") - cPluginManager:CallPlugin("NoSuchPlugin", "FnName", "SomeParam") - LOG("Debuggers: Calling Core.NoSuchFunction()...") - cPluginManager:CallPlugin("Core", "NoSuchFunction", "SomeParam") - LOG("Debuggers: Calling Core.ReturnColorFromChar(..., \"8\")...") - local Gray = cPluginManager:CallPlugin("Core", "ReturnColorFromChar", "split", "8") - if (Gray ~= cChatColor.Gray) then - LOGWARNING("Debuggers: Call failed, exp " .. cChatColor.Gray .. ", got " .. (Gray or "")) - else - LOG("Debuggers: Call succeeded") - end - LOG("Debuggers: Inter-plugin calls done.") -end - - - - - function TestBlockAreas() LOG("Testing block areas..."); @@ -1993,6 +1945,18 @@ end +function HandleConsolePluginStats(a_Split) + cPluginManager:ForEachPlugin( + function (a_CBPlugin) + LOG("Plugin in " .. a_CBPlugin:GetFolderName() .. " has an API name of " .. a_CBPlugin:GetName() .. " and status " .. a_CBPlugin:GetStatus()) + end + ) + return true +end + + + + function HandleConsolePrepareChunk(a_Split) -- Check params: local numParams = #a_Split -- cgit v1.2.3