summaryrefslogtreecommitdiff
path: root/src/argent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/argent.c')
-rw-r--r--src/argent.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/argent.c b/src/argent.c
index 7426394..b83f851 100644
--- a/src/argent.c
+++ b/src/argent.c
@@ -6,6 +6,7 @@
#include "options.h"
#include "bindings.h"
+#include "logging.h"
struct settings {
@@ -15,41 +16,43 @@ struct settings {
int main(int argc, char **argv)
{
+ argent_log(DEBUG, "parse command-line options");
struct argent_options opts;
int error = parse_options(&opts, argc, argv);
-
if (error)
return 1;
- printf("configuration file: %s\n"
- "output directory: %s\n",
- opts.conf_filename,
- opts.output_dir);
+ argent_log(INFO, "log level: %s", level_string(argent_log_level));
+ argent_log(INFO, "configuration file: %s", opts.conf_filename);
+ argent_log(INFO, "output directory: %s", opts.output_dir);
+ argent_log(DEBUG, "create lua state");
lua_State *L = luaL_newstate();
luaL_openlibs(L);
+ argent_log(DEBUG, "create argent table");
hs_create_table
(L,
hs_str_cfunc("markdown", markdown)
);
lua_setglobal(L, "argent");
+ argent_log(DEBUG, "load configuration file");
error = luaL_loadfile(L, opts.conf_filename);
if (error != 0) {
- fprintf(stderr, "error: %s\n", lua_tostring(L, -1));
+ argent_log(FATAL, "lua error: %s", lua_tostring(L, -1));
lua_close(L);
return error;
}
+ argent_log(DEBUG, "run configuration file");
error = hs_call(L, 0, 1);
if (error != 0) {
- fprintf(stderr, "error: %s\n", lua_tostring(L, -1));
+ argent_log(FATAL, "lua error: %s", lua_tostring(L, -1));
lua_close(L);
return error;
}
- printf("here!\n");
-
+ argent_log(DEBUG, "close lua state");
lua_close(L);
return 0;
}