Browse Source

[Minor] Reputation Plugin - Debug Logging

tags/1.8.2
Carsten Rosenberg 5 years ago
parent
commit
cd77ddfbc7
1 changed files with 14 additions and 12 deletions
  1. 14
    12
      src/plugins/lua/reputation.lua

+ 14
- 12
src/plugins/lua/reputation.lua View File

if selector_res then if selector_res then
if type(selector_res) == 'table' then if type(selector_res) == 'table' then
fun.each(function(e) fun.each(function(e)
lua_util.debugm(N, task, 'check generic reputation %s', e)
lua_util.debugm(N, task, 'check generic reputation (%s) %s',
rule['symbol'], e)
rule.backend.get_token(task, rule, e, tokens_cb) rule.backend.get_token(task, rule, e, tokens_cb)
end, selector_res) end, selector_res)
else else
lua_util.debugm(N, task, 'check generic reputation %s', selector_res)
lua_util.debugm(N, task, 'check generic reputation (%s) %s',
rule['symbol'], selector_res)
rule.backend.get_token(task, rule, selector_res, tokens_cb) rule.backend.get_token(task, rule, selector_res, tokens_cb)
end end
end end
if need_set then if need_set then
if type(selector_res) == 'table' then if type(selector_res) == 'table' then
fun.each(function(e) fun.each(function(e)
lua_util.debugm(N, task, 'set generic selector %s = %s',
e, token)
lua_util.debugm(N, task, 'set generic selector (%s) %s = %s',
rule['symbol'], e, token)
rule.backend.set_token(task, rule, e, token) rule.backend.set_token(task, rule, e, token)
end, selector_res) end, selector_res)
else else
lua_util.debugm(N, task, 'set generic selector %s = %s',
selector_res, token)
lua_util.debugm(N, task, 'set generic selector (%s) %s = %s',
rule['symbol'], selector_res, token)
rule.backend.set_token(task, rule, selector_res, token) rule.backend.set_token(task, rule, selector_res, token)
end end
end end
values[data[i]] = ndata values[data[i]] = ndata
end end
end end
lua_util.debugm(N, task, 'got values for key %s -> %s',
key, values)
lua_util.debugm(N, task, 'rule %s - got values for key %s -> %s',
rule['symbol'], key, values)
continuation_cb(nil, key, values) continuation_cb(nil, key, values)
else else
rspamd_logger.errx(task, 'invalid type while getting reputation keys %s: %s',
key, type(data))
rspamd_logger.errx(task, 'rule %s - invalid type while getting reputation keys %s: %s',
rule['symbol'], key, type(data))
continuation_cb("invalid type", key, nil) continuation_cb("invalid type", key, nil)
end end


table.insert(args, k) table.insert(args, k)
table.insert(args, v) table.insert(args, v)
end end
lua_util.debugm(N, task, 'set values for key %s -> %s',
key, values)
lua_util.debugm(N, task, 'rule %s - set values for key %s -> %s',
rule['symbol'], key, values)
local ret = lua_redis.exec_redis_script(rule.backend.script_set, local ret = lua_redis.exec_redis_script(rule.backend.script_set,
{task = task, is_write = true}, {task = task, is_write = true},
redis_set_cb, redis_set_cb,

Loading…
Cancel
Save