// Source: https://redislabs.com/blog/5-methods-for-tracing-and-debugging-redis-lua-scripts#.VL2w7GRNoq4
- Use Redis Log
redis.log(redis.LOG_WARNING, "foo bar")
- Return log as Lua table
local logtable = {}
local function logit(msg)
logtable[#logtable+1] = msg
end
logit("foo")
logit("bar")
return logtable
- Use Redis to store the logs
local loglist = "log"
-- DEL log
local function logit(msg)
redis.pcall("RPUSH", loglist, msg)
end
-- LRANGE log 0 -1
logit("foo")
logit("bar")