aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_logger.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-12 14:44:49 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-12 14:44:49 +0000
commit2f1cf619fc28ed3582cf641201aee3c0dc8c6c84 (patch)
tree6d4605c28a11f8f0cc71a14e7426c1eb32efb554 /src/lua/lua_logger.c
parenteecfe4ea3aca90f90f3db562b5a8b38c310ec816 (diff)
downloadrspamd-2f1cf619fc28ed3582cf641201aee3c0dc8c6c84.tar.gz
rspamd-2f1cf619fc28ed3582cf641201aee3c0dc8c6c84.zip
[Feature] Print map id when using it in lua logger
Diffstat (limited to 'src/lua/lua_logger.c')
-rw-r--r--src/lua/lua_logger.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lua/lua_logger.c b/src/lua/lua_logger.c
index 8f2f62c03..66c472a27 100644
--- a/src/lua/lua_logger.c
+++ b/src/lua/lua_logger.c
@@ -14,6 +14,8 @@
* limitations under the License.
*/
#include "lua_common.h"
+#include "libutil/map.h"
+#include "libutil/map_private.h"
/***
* @module rspamd_logger
@@ -480,6 +482,21 @@ lua_logger_logx (lua_State *L, GLogLevelFlags level, gboolean is_string)
uid = cfg->checksum;
}
}
+ else if (strcmp (clsname, "rspamd{map}") == 0) {
+ struct rspamd_lua_map *map;
+
+ map = lua_check_map (L, 1);
+
+ if (map) {
+ if (map->map) {
+ uid = map->map->pool->tag.uid;
+ }
+ else {
+ uid = "embedded";
+ }
+ }
+ }
+
/* Metatable, __index, classname */
lua_pop (L, 3);