mirror of
https://github.com/lxsang/antd-lua-plugin
synced 2024-12-26 01:18:22 +01:00
allow lua to log to syslog
This commit is contained in:
parent
6276b0aa1e
commit
4259ec7eef
@ -102,6 +102,7 @@ void* lua_handle(void* data, void* meta)
|
||||
__t(client, "Cannot run router: %s", lua_tostring(L, -1));
|
||||
}
|
||||
free(index);*/
|
||||
LOG("LUA handle exit on %d", rq->client->sock);
|
||||
// clear request
|
||||
if(L)
|
||||
lua_close(L);
|
||||
|
@ -182,6 +182,13 @@ static int l_setgid(lua_State* L)
|
||||
lua_pushboolean(L,0);
|
||||
return 1;
|
||||
}
|
||||
static int l_syslog(lua_State* L)
|
||||
{
|
||||
const int prio = luaL_checknumber(L,1);
|
||||
const char* msg = luaL_checkstring(L,2);
|
||||
syslog(prio, "%s", msg);
|
||||
return 1;
|
||||
}
|
||||
static int l_getuid(lua_State* L)
|
||||
{
|
||||
const char* name = luaL_checkstring(L,1);
|
||||
@ -769,6 +776,7 @@ static const struct luaL_Reg _lib [] = {
|
||||
{"unsetenv",l_unsetenv},
|
||||
{"home_dir",l_gethomedir},
|
||||
{"send_file", l_send_file},
|
||||
{"syslog", l_syslog},
|
||||
{NULL,NULL}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user