소스 검색

[Minor] Allow to get a trace function

tags/1.8.0
Vsevolod Stakhov 5 년 전
부모
커밋
d595b6ef94
1개의 변경된 파일20개의 추가작업 그리고 0개의 파일을 삭제
  1. 20
    0
      src/lua/lua_common.c

+ 20
- 0
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;
}


Loading…
취소
저장