diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-09-03 16:56:58 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-09-03 16:56:58 +0100 |
commit | b361af86b99c7e4b6e6f3fcd508b882ffb0c9d9e (patch) | |
tree | da77ab79247ff8ea21c93fdd266f8621438d0c59 /src/lua | |
parent | b18c9d7e6132a75c2e2b52eaadfe32adf5debf5d (diff) | |
download | rspamd-b361af86b99c7e4b6e6f3fcd508b882ffb0c9d9e.tar.gz rspamd-b361af86b99c7e4b6e6f3fcd508b882ffb0c9d9e.zip |
Add tests and fix some issues.
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_logger.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lua/lua_logger.c b/src/lua/lua_logger.c index ab1f49e4a..d82237f55 100644 --- a/src/lua/lua_logger.c +++ b/src/lua/lua_logger.c @@ -47,8 +47,10 @@ local e = { } -- New extended interface +-- %<number> means numeric arguments and %s means the next argument +-- for example %1, %2, %s: %s would mean the third argument -rspamd_logger.infox('a=%1, b=%2, c=%3, d=%4, e=%5', a, b, c, d, e) +rspamd_logger.infox('a=%1, b=%2, c=%3, d=%4, e=%s', a, b, c, d, e) -- Output: a=string, b=1.50000, c=1, d={[1] = aa, [2] = 1, [3] = bb} e={[key]=value, [key2]=1.0} -- Legacy interface (can handle merely strings) @@ -449,7 +451,6 @@ lua_logger_logx (lua_State *L, GLogLevelFlags level, gboolean is_string) lua_pushstring (L, "__index"); lua_gettable (L, -2); - lua_istable (L, -1); lua_pushstring (L, "class"); lua_gettable (L, -2); @@ -493,7 +494,7 @@ lua_logger_logx (lua_State *L, GLogLevelFlags level, gboolean is_string) s = lua_tostring (L, fmt_pos); c = s; - cur_arg = fmt_pos + 1; + cur_arg = fmt_pos; if (s == NULL) { return 0; @@ -531,7 +532,7 @@ lua_logger_logx (lua_State *L, GLogLevelFlags level, gboolean is_string) arg_num = strtoul (c, NULL, 10); arg_num += fmt_pos - 1; /* Update the current argument */ - cur_arg = arg_num + 1; + cur_arg = arg_num; } else { /* We have non numeric argument, e.g. %s */ |