about summary refs log tree commit diff stats
path: root/src/main.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-02-21 21:10:00 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-21 21:10:00 +0100
commit75cfe38808e76a5308dac7023876a9826ed56347 (patch)
tree4138100b492967b704007e3bde130cce4cc98269 /src/main.c
parent99dc1c9494f5f84fae4082bac2a0dec5319232ce (diff)
downloadprofani-tty-75cfe38808e76a5308dac7023876a9826ed56347.tar.gz
Allow setting custom log file via -f FILENAME
`profanity -f TEST` will use `~/.local/share/profanity/logs/TEST.log` as
the log file.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index fff74785..33367743 100644
--- a/src/main.c
+++ b/src/main.c
@@ -61,6 +61,7 @@
 
 static gboolean version = FALSE;
 static char *log = "INFO";
+static char *log_file = NULL;
 static char *account_name = NULL;
 static char *config_file = NULL;
 
@@ -76,8 +77,9 @@ main(int argc, char **argv)
     {
         { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Show version information", NULL },
         { "account", 'a', 0, G_OPTION_ARG_STRING, &account_name, "Auto connect to an account on startup" },
-        { "log",'l', 0, G_OPTION_ARG_STRING, &log, "Set logging levels, DEBUG, INFO (default), WARN, ERROR", "LEVEL" },
-        { "config",'c', 0, G_OPTION_ARG_STRING, &config_file, "Use an alternative configuration file", NULL },
+        { "log", 'l', 0, G_OPTION_ARG_STRING, &log, "Set logging levels, DEBUG, INFO (default), WARN, ERROR", "LEVEL" },
+        { "config", 'c', 0, G_OPTION_ARG_STRING, &config_file, "Use an alternative configuration file", NULL },
+        { "logfile", 'f', 0, G_OPTION_ARG_STRING, &log_file, "Specify log filename", NULL },
         { NULL }
     };
 
@@ -173,7 +175,7 @@ main(int argc, char **argv)
         return 0;
     }
 
-    prof_run(log, account_name, config_file);
+    prof_run(log, account_name, config_file, log_file);
 
     return 0;
 }