summaryrefslogtreecommitdiff
path: root/luaif/luaif.c
diff options
context:
space:
mode:
Diffstat (limited to 'luaif/luaif.c')
-rw-r--r--luaif/luaif.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/luaif/luaif.c b/luaif/luaif.c
index 2319c92..411bb20 100644
--- a/luaif/luaif.c
+++ b/luaif/luaif.c
@@ -332,6 +332,10 @@ static int lua_sb_log(lua_State *luastate)
SB_LOG(SB_LOGLEVEL_WARNING, "WARNING: %s", logmsg);
else if(!strcmp(loglevel, "error"))
SB_LOG(SB_LOGLEVEL_ERROR, "ERROR: %s", logmsg);
+ else if(!strcmp(loglevel, "noise"))
+ SB_LOG(SB_LOGLEVEL_NOISE, ">>>>: %s", logmsg);
+ else if(!strcmp(loglevel, "noise2"))
+ SB_LOG(SB_LOGLEVEL_NOISE2, ">>>>>>: %s", logmsg);
else /* default to level "error" */
SB_LOG(SB_LOGLEVEL_ERROR, "%s", logmsg);
@@ -387,6 +391,20 @@ static int lua_sb_path_exists(lua_State *l)
return 1;
}
+/* "sb.debug_messages_enabled", to be called from lua code
+ * returns true if SB_LOG messages have been enabled for the debug levels
+ * (debug,noise,noise2...)
+*/
+static int lua_sb_debug_messages_enabled(lua_State *l)
+{
+ if (SB_LOG_IS_ACTIVE(SB_LOGLEVEL_DEBUG)) {
+ lua_pushboolean(l, 1);
+ } else {
+ lua_pushboolean(l, 0);
+ }
+ return 1;
+}
+
/* mappings from c to lua */
static const luaL_reg reg[] =
{
@@ -396,6 +414,7 @@ static const luaL_reg reg[] =
{"log", lua_sb_log},
{"setenv", lua_sb_setenv},
{"path_exists", lua_sb_path_exists},
+ {"debug_messages_enabled", lua_sb_debug_messages_enabled},
{NULL, NULL}
};