commit 14b2f69
default
·
2023-06-15 04:15:39 +0000 UTC
parent 9a4ff57
If a ~/log/ folder exists, also write the log there.
3 files changed,
+8,
-2
M
data.c
+3,
-0
1@@ -545,6 +545,9 @@ xs_list *index_list_desc(const char *fn, int skip, int show)
2
3 xs_str *_object_fn_by_md5(const char *md5)
4 {
5+ if (!xs_is_hex(md5))
6+ srv_log(xs_fmt("_object_fn_by_md5(): '%s' not hex", md5));
7+
8 xs *bfn = xs_fmt("%s/object/%c%c", srv_basedir, md5[0], md5[1]);
9
10 mkdirx(bfn);
+2,
-0
1@@ -89,6 +89,8 @@ including HTTP headers. Only useful for debugging. May grow to enormous sizes.
2 .It Pa error/
3 If this directory exists, HTTP signature check error headers are logged here.
4 Only useful for debugging.
5+.It Pa log/
6+If this directory exists, log messages are also stored there in daily files.
7 .It Pa app/
8 This directory stores Mastodon API apps.
9 .It Pa token/
M
snac.c
+3,
-2
1@@ -95,8 +95,9 @@ void srv_debug(int level, xs_str *str)
2 xs *tm = xs_str_localtime(0, "%H:%M:%S");
3 fprintf(stderr, "%s %s\n", tm, str);
4
5- /* if the ~/error/ folder exists, also write to a file there */
6- xs *lf = xs_fmt("%s/error/debug.log", srv_basedir);
7+ /* if the ~/log/ folder exists, also write to a file there */
8+ xs *dt = xs_str_localtime(0, "%Y-%m-%d");
9+ xs *lf = xs_fmt("%s/log/%s.log", srv_basedir, dt);
10 FILE *f;
11 if ((f = fopen(lf, "a")) != NULL) {
12 fprintf(f, "%s %s\n", tm, str);