mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Adds lua function calls tracking code
This commit is contained in:
parent
1fbd03e0da
commit
ea5c70da73
1 changed files with 29 additions and 0 deletions
|
|
@ -7,6 +7,35 @@ local http_lint = {}
|
|||
local json = require "dkjson"
|
||||
local alert_consts = require "alert_consts"
|
||||
|
||||
--[[
|
||||
local function tracker(f)
|
||||
return function(...)
|
||||
local f_name = debug.getinfo(1, "n").name
|
||||
|
||||
local args_print = {}
|
||||
for k, v in pairs({...}) do
|
||||
args_print[k] = tostring(v)
|
||||
end
|
||||
|
||||
local fmt = string.format("%s(%s)\n", f_name, table.concat(args_print or {}, " "))
|
||||
io.write(fmt)
|
||||
|
||||
local result = {f(...)}
|
||||
|
||||
return table.unpack(result)
|
||||
end
|
||||
end
|
||||
|
||||
local fns = {"resetUserPassword"}
|
||||
local mt = getmetatable(ntop).__index
|
||||
|
||||
for _, fn in pairs(fns) do
|
||||
if mt[fn] and type(mt[fn]) == "function" then
|
||||
mt[fn] = tracker(mt[fn])
|
||||
end
|
||||
end
|
||||
--]]
|
||||
|
||||
-- #################################################################
|
||||
|
||||
-- UTILITY FUNCTIONS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue