25static bool LuaGetAr(
lua_State *L, lua_Debug *ar)
27 if (lua_getstack(L, 1, ar) && lua_getinfo(L,
"nSl", ar)) {
35 const char *msg = luaL_checkstring(L, 1);
37 if (LuaGetAr(L, &ar)) {
38 const char *funcname = ar.name ? ar.name : ar.what;
39 SCLogInfoRaw(ar.short_src, funcname, ar.currentline,
"%s", msg);
48 const char *msg = luaL_checkstring(L, 1);
50 if (LuaGetAr(L, &ar)) {
51 const char *funcname = ar.name ? ar.name : ar.what;
62 const char *msg = luaL_checkstring(L, 1);
64 if (LuaGetAr(L, &ar)) {
65 const char *funcname = ar.name ? ar.name : ar.what;
75 const char *msg = luaL_checkstring(L, 1);
77 if (LuaGetAr(L, &ar)) {
78 const char *funcname = ar.name ? ar.name : ar.what;
79 SCLogErrorRaw(ar.short_src, funcname, ar.currentline,
"%s", msg);
89 const char *msg = luaL_checkstring(L, 1);
91 if (LuaGetAr(L, &ar)) {
92 const char *funcname = ar.name ? ar.name : ar.what;
93 SCLogDebugRaw(ar.short_src, funcname, ar.currentline,
"%s", msg);
103 const char *msg = luaL_checkstring(L, 1);
105 if (LuaGetAr(L, &ar)) {
106 const char *funcname = ar.name ? ar.name : ar.what;
107 SCLogConfigRaw(ar.short_src, funcname, ar.currentline,
"%s", msg);
116 const char *msg = luaL_checkstring(L, 1);
118 if (LuaGetAr(L, &ar)) {
119 const char *funcname = ar.name ? ar.name : ar.what;
120 SCLogPerfRaw(ar.short_src, funcname, ar.currentline,
"%s", msg);
127static const struct luaL_Reg loglib[] = {
129 {
"info", LuaLogInfo },
130 {
"notice", LuaLogNotice },
131 {
"warning", LuaLogWarning },
132 {
"error", LuaLogError },
133 {
"debug", LuaLogDebug },
134 {
"config", LuaLogConfig },
135 {
"perf", LuaLogPerf },
142 luaL_newlib(L, loglib);
struct lua_State lua_State
#define SCLogConfigRaw(file, func, line,...)
#define SCLogInfoRaw(file, func, line,...)
#define SCLogNotice(...)
Macro used to log NOTICE messages.
#define SCLogWarning(...)
Macro used to log WARNING messages.
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
#define SCLogErrorRaw(file, func, line,...)
#define SCLogError(...)
Macro used to log ERROR messages.
#define SCLogNoticeRaw(file, func, line,...)
#define SCLogPerfRaw(file, func, line,...)
#define SCLogWarningRaw(file, func, line,...)
int SCLuaLoadLogLib(lua_State *L)