From: Vsevolod Stakhov Date: Thu, 9 Aug 2018 13:58:45 +0000 (+0100) Subject: [Minor] Allow to get a trace function X-Git-Tag: 1.8.0~289 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d595b6ef94b3b1e1412cda2232fa4627ac67926e;p=thirdparty%2Frspamd.git [Minor] Allow to get a trace function --- diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 4faff86650..7d9e525bb4 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -688,6 +688,21 @@ rspamd_lua_set_globals (struct rspamd_config *cfg, lua_State *L, lua_settop (L, orig_top); } +#ifdef WITH_LUA_TRACE +static gint +lua_push_trace_data (lua_State *L) +{ + if (lua_traces) { + ucl_object_push_lua (L, lua_traces, true); + } + else { + lua_pushnil (L); + } + + return 1; +} +#endif + lua_State * rspamd_lua_init () { @@ -783,6 +798,11 @@ rspamd_lua_init () #undef ADD_TABLE lua_setglobal (L, rspamd_modules_state_global); +#ifdef WITH_LUA_TRACE + lua_pushcfunction (L, lua_push_trace_data); + lua_setglobal (L, "get_traces"); +#endif + return L; }