mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Added datestamped logs
This commit is contained in:
parent
2294d908f6
commit
48936c0a95
@ -51,7 +51,6 @@ chat_log_chat(const gchar * const login, gchar *other,
|
|||||||
|
|
||||||
if (logpp == NULL) {
|
if (logpp == NULL) {
|
||||||
GString *log_file = g_string_new(getenv("HOME"));
|
GString *log_file = g_string_new(getenv("HOME"));
|
||||||
|
|
||||||
g_string_append(log_file, "/.profanity/log");
|
g_string_append(log_file, "/.profanity/log");
|
||||||
create_dir(log_file->str);
|
create_dir(log_file->str);
|
||||||
|
|
||||||
@ -61,11 +60,18 @@ chat_log_chat(const gchar * const login, gchar *other,
|
|||||||
free(login_dir);
|
free(login_dir);
|
||||||
|
|
||||||
gchar *other_file = str_replace(other, "@", "_at_");
|
gchar *other_file = str_replace(other, "@", "_at_");
|
||||||
g_string_append_printf(log_file, "/%s.log", other_file);
|
g_string_append_printf(log_file, "/%s", other_file);
|
||||||
logp = fopen(log_file->str, "a");
|
|
||||||
free(other_file);
|
|
||||||
|
|
||||||
|
GDateTime *dt = g_date_time_new_now_local();
|
||||||
|
gchar *date = g_date_time_format(dt, "_%d_%m_%Y.log");
|
||||||
|
g_string_append_printf(log_file, date);
|
||||||
|
|
||||||
|
logp = fopen(log_file->str, "a");
|
||||||
|
|
||||||
|
free(other_file);
|
||||||
|
g_date_time_unref(dt);
|
||||||
g_string_free(log_file, TRUE);
|
g_string_free(log_file, TRUE);
|
||||||
|
|
||||||
g_hash_table_insert(logs, other, logp);
|
g_hash_table_insert(logs, other, logp);
|
||||||
} else {
|
} else {
|
||||||
logp = (FILE *) logpp;
|
logp = (FILE *) logpp;
|
||||||
|
Loading…
Reference in New Issue
Block a user