1
0

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.
This commit is contained in:
Mattes D 2017-01-01 22:44:13 +01:00 committed by GitHub
parent ad476e1cf9
commit 45ce828a16
2 changed files with 21 additions and 51 deletions

View File

@ -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 "<nil>"))
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

View File

@ -290,6 +290,12 @@ g_PluginInfo =
HelpString = "Loads the specified chunk into memory",
},
["pluginstats"] =
{
Handler = HandleConsolePluginStats,
HelpString = "Shows the stats for each plugin",
},
["preparechunk"] =
{
Handler = HandleConsolePrepareChunk,