summaryrefslogtreecommitdiff
path: root/snac.c
diff options
context:
space:
mode:
authorGravatar default2023-06-15 06:15:39 +0200
committerGravatar default2023-06-15 06:15:39 +0200
commit14b2f697689fbdfa946b310d65ef3079ee7fec5b (patch)
treed3670c1b429039d2716c879ada71a0e4f094ffac /snac.c
parentUpdated RELEASE_NOTES. (diff)
downloadpenes-snac2-14b2f697689fbdfa946b310d65ef3079ee7fec5b.tar.gz
penes-snac2-14b2f697689fbdfa946b310d65ef3079ee7fec5b.tar.xz
penes-snac2-14b2f697689fbdfa946b310d65ef3079ee7fec5b.zip
If a ~/log/ folder exists, also write the log there.
Diffstat (limited to '')
-rw-r--r--snac.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/snac.c b/snac.c
index 41e1984..7fbb61e 100644
--- a/snac.c
+++ b/snac.c
@@ -95,8 +95,9 @@ void srv_debug(int level, xs_str *str)
95 xs *tm = xs_str_localtime(0, "%H:%M:%S"); 95 xs *tm = xs_str_localtime(0, "%H:%M:%S");
96 fprintf(stderr, "%s %s\n", tm, str); 96 fprintf(stderr, "%s %s\n", tm, str);
97 97
98 /* if the ~/error/ folder exists, also write to a file there */ 98 /* if the ~/log/ folder exists, also write to a file there */
99 xs *lf = xs_fmt("%s/error/debug.log", srv_basedir); 99 xs *dt = xs_str_localtime(0, "%Y-%m-%d");
100 xs *lf = xs_fmt("%s/log/%s.log", srv_basedir, dt);
100 FILE *f; 101 FILE *f;
101 if ((f = fopen(lf, "a")) != NULL) { 102 if ((f = fopen(lf, "a")) != NULL) {
102 fprintf(f, "%s %s\n", tm, str); 103 fprintf(f, "%s %s\n", tm, str);