diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-16 13:16:10 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-16 13:16:10 +0100 |
commit | 66fb74246b4b27d65d79e45e0280fe3ab71c0923 (patch) | |
tree | 086123a031954f529994e4db29ef7f0b321bcd86 /src | |
parent | cf14248f9c96cd7bbdd23df02c2880cfe7ba284c (diff) | |
download | rspamd-66fb74246b4b27d65d79e45e0280fe3ab71c0923.tar.gz rspamd-66fb74246b4b27d65d79e45e0280fe3ab71c0923.zip |
[Minor] Lua_logger: Support light userdata
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/lua_logger.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/lua/lua_logger.c b/src/lua/lua_logger.c index bca4bc6e3..f76db8877 100644 --- a/src/lua/lua_logger.c +++ b/src/lua/lua_logger.c @@ -575,31 +575,34 @@ lua_logger_out_type (lua_State *L, gint pos, trace->cur_level ++; switch (type) { - case LUA_TNUMBER: - r = lua_logger_out_num (L, pos, outbuf, len, trace); - break; - case LUA_TBOOLEAN: - r = lua_logger_out_boolean (L, pos, outbuf, len, trace); - break; - case LUA_TTABLE: - r = lua_logger_out_table (L, pos, outbuf, len, trace, esc_type); - break; - case LUA_TUSERDATA: - r = lua_logger_out_userdata (L, pos, outbuf, len, trace); - break; - case LUA_TFUNCTION: - r = rspamd_snprintf (outbuf, len + 1, "function"); - break; - case LUA_TNIL: - r = rspamd_snprintf (outbuf, len + 1, "nil"); - break; - case LUA_TNONE: - r = rspamd_snprintf (outbuf, len + 1, "no value"); - break; - default: - /* Try to push everything as string using tostring magic */ - r = lua_logger_out_str (L, pos, outbuf, len, trace, esc_type); - break; + case LUA_TNUMBER: + r = lua_logger_out_num (L, pos, outbuf, len, trace); + break; + case LUA_TBOOLEAN: + r = lua_logger_out_boolean (L, pos, outbuf, len, trace); + break; + case LUA_TTABLE: + r = lua_logger_out_table (L, pos, outbuf, len, trace, esc_type); + break; + case LUA_TUSERDATA: + r = lua_logger_out_userdata (L, pos, outbuf, len, trace); + break; + case LUA_TFUNCTION: + r = rspamd_snprintf (outbuf, len + 1, "function"); + break; + case LUA_TLIGHTUSERDATA: + r = rspamd_snprintf (outbuf, len + 1, "0x%p", lua_topointer (L, pos)); + break; + case LUA_TNIL: + r = rspamd_snprintf (outbuf, len + 1, "nil"); + break; + case LUA_TNONE: + r = rspamd_snprintf (outbuf, len + 1, "no value"); + break; + default: + /* Try to push everything as string using tostring magic */ + r = lua_logger_out_str (L, pos, outbuf, len, trace, esc_type); + break; } trace->cur_level --; |