mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-28 23:16:21 +00:00
Allow setting custom log file via -f FILENAME
`profanity -f TEST` will use `~/.local/share/profanity/logs/TEST.log` as the log file.
This commit is contained in:
@@ -112,16 +112,26 @@ files_get_inputrc_file(void)
|
||||
}
|
||||
|
||||
char*
|
||||
files_get_log_file(void)
|
||||
files_get_log_file(char *log_file)
|
||||
{
|
||||
gchar *xdg_data = _files_get_xdg_data_home();
|
||||
GString *logfile = g_string_new(xdg_data);
|
||||
g_string_append(logfile, "/profanity/logs/profanity");
|
||||
|
||||
if (log_file) {
|
||||
g_string_append(logfile, "/profanity/logs/");
|
||||
g_string_append(logfile, log_file);
|
||||
} else {
|
||||
g_string_append(logfile, "/profanity/logs/profanity");
|
||||
}
|
||||
|
||||
if (!prefs_get_boolean(PREF_LOG_SHARED)) {
|
||||
g_string_append_printf(logfile, "%d", getpid());
|
||||
}
|
||||
|
||||
g_string_append(logfile, ".log");
|
||||
|
||||
char *result = strdup(logfile->str);
|
||||
|
||||
free(xdg_data);
|
||||
g_string_free(logfile, TRUE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user