add new debug command trace

This commit is contained in:
Cloud Wu
2018-06-08 11:24:27 +08:00
parent 4b5fbab129
commit 3a1556e1fd
3 changed files with 45 additions and 7 deletions

View File

@@ -158,6 +158,7 @@ function COMMAND.help()
shrtbl = "Show shared short string table info",
ping = "ping address",
call = "call address ...",
trace = "trace address [proto] [on|off]",
}
end
@@ -343,6 +344,22 @@ function COMMAND.ping(address)
return tostring(ti)
end
local function toboolean(x)
return x and (x == "true" or x == "on")
end
function COMMAND.trace(address, proto, flag)
address = adjust_address(address)
if flag == nil then
if proto == "on" or proto == "off" then
proto = toboolean(proto)
end
else
flag = toboolean(flag)
end
skynet.call(address, "debug", "TRACELOG", proto, flag)
end
function COMMANDX.call(cmd)
local address = adjust_address(cmd[2])
local cmdline = assert(cmd[1]:match("%S+%s+%S+%s(.+)") , "need arguments")