aboutsummaryrefslogtreecommitdiff
path: root/ge.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2023-07-25 20:10:53 +0000
committerOmar Polo <op@omarpolo.com>2023-07-25 20:10:53 +0000
commit857635a1075e664cecc4e40fbbf7e5787b8cc974 (patch)
tree077de36b372fcb415833df813875ab522ed0bc26 /ge.c
parentaea87ce91f8c81ecc8cb6e95ca97d73232303af6 (diff)
use the condensed logging style in ge too
Diffstat (limited to 'ge.c')
-rw-r--r--ge.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/ge.c b/ge.c
index d6d1b90..071ab9e 100644
--- a/ge.c
+++ b/ge.c
@@ -43,7 +43,17 @@ void
log_request(struct client *c, int code, const char *meta)
{
char b[GEMINI_URL_LEN];
+ char rfc3339[32];
const char *t;
+ struct tm *tm;
+ time_t now;
+
+ if ((now = time(NULL)) == -1)
+ fatal("time");
+ if ((tm = localtime(&now)) == NULL)
+ fatal("localtime");
+ if (strftime(rfc3339, sizeof(rfc3339), "%FT%T%z", tm) == 0)
+ fatal("strftime");
if (c->iri.schema != NULL) {
/* serialize the IRI */
@@ -70,8 +80,9 @@ log_request(struct client *c, int code, const char *meta)
strlcpy(b, t, sizeof(b));
}
- fprintf(stderr, "%s:%s GET %s %d %s\n", c->rhost, c->rserv, b,
- code, meta);
+ fprintf(stderr, "%s %s - %s %s 0 %d %s\n", rfc3339,
+ c->rhost, *c->domain == '\0' ? c->iri.host : c->domain,
+ b, code, meta);
}
void