[grilo-plugins] lua-factory: Add debug and warning Lua bindings



commit 64b755b4f6b3ad892cc00919e4cb8a8e5cb4cf9d
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 25 13:11:29 2014 +0100

    lua-factory: Add debug and warning Lua bindings
    
    Even if we can easily modify sources (most of the time), we want
    developers to sprinkle this to aid with debugging.

 src/lua-factory/grl-lua-library.c |   38 +++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-library.c b/src/lua-factory/grl-lua-library.c
index f15f3d5..dbdd88c 100644
--- a/src/lua-factory/grl-lua-library.c
+++ b/src/lua-factory/grl-lua-library.c
@@ -537,6 +537,42 @@ grl_l_callback (lua_State *L)
   return 0;
 }
 
+/**
+ * grl.debug
+ *
+ * @str: (string) the debug output to generate
+ */
+static gint
+grl_l_debug (lua_State *L)
+{
+  const gchar *str;
+
+  luaL_argcheck (L, lua_isstring (L, 1), 1, "expecting debug output as string");
+
+  str = lua_tolstring (L, 1, NULL);
+  GRL_DEBUG ("%s", str);
+
+  return 0;
+}
+
+/**
+ * grl.warning
+ *
+ * @str: (string) the debug output to generate
+ */
+static gint
+grl_l_warning (lua_State *L)
+{
+  const gchar *str;
+
+  luaL_argcheck (L, lua_isstring (L, 1), 1, "expecting warning output as string");
+
+  str = lua_tolstring (L, 1, NULL);
+  GRL_WARNING ("%s", str);
+
+  return 0;
+}
+
 /* ================== Lua-Library initialization =========================== */
 
 gint
@@ -548,6 +584,8 @@ luaopen_grilo (lua_State *L)
     {"get_media_keys", &grl_l_media_get_keys},
     {"callback", &grl_l_callback},
     {"fetch", &grl_l_fetch},
+    {"debug", &grl_l_debug},
+    {"warning", &grl_l_warning},
     {NULL, NULL}
   };
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]