summaryrefslogtreecommitdiff
path: root/src/bindings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings.c')
-rw-r--r--src/bindings.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/bindings.c b/src/bindings.c
index 8e7d4d5..1e24570 100644
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -321,3 +321,34 @@ int copy_file(lua_State *L)
return 0;
}
+
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+int argent_log_lua(lua_State *L)
+{
+ char *level_string, *message;
+ hs_parse_args(L, hs_str(level_string), hs_str(message));
+
+ int level;
+
+ if(strcmp(level_string, "fatal") == 0)
+ level = FATAL;
+ else if (strcmp(level_string, "error") == 0)
+ level = ERROR;
+ else if (strcmp(level_string, "warn") == 0)
+ level = WARN;
+ else if (strcmp(level_string, "info") == 0)
+ level = INFO;
+ else if (strcmp(level_string, "debug") == 0)
+ level = DEBUG;
+ else if (strcmp(level_string, "trace") == 0)
+ level = TRACE;
+ else {
+ argent_log(WARN, "level '%s' is invalid; defaulting to 'info'", level_string);
+ level = INFO;
+ }
+
+ argent_log(level, message);
+ return 0;
+}