commit cb583e0afe36899f1b0fd0f5439fc1676d59326c
parent 422f753bfbb3606bdd7edf10a1d87f4d5433c294
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Thu, 26 Aug 2021 12:40:21 -0700
Update log format and messages
Diffstat:
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/aps/aps.c b/aps/aps.c
@@ -204,7 +204,7 @@ aps_command(struct aps *aps, int s)
return 0;
buf = aps->clients[s].request;
- aps_log(aps, COMMAND, s, buf->data);
+ aps_logfmt(aps, COMMAND, s, "input '%s'", buf->data);
argv = asplit(buf->data, AP_QUOTE, AP_ARG_SEPS);
if (argv == NULL)
return 1;
diff --git a/aps/log.c b/aps/log.c
@@ -70,7 +70,7 @@ aps_logfmt(struct aps *aps, int level, int fd, char *fmt, ...)
if (fmt == NULL || (aps && !(level & aps->loglevel)))
return;
- fprintf(stderr, "ap(%d): %s: ", fd, levelstr(level));
+ fprintf(stderr, "ap: [%d] [%s] ", fd, levelstr(level));
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
diff --git a/aps/response.c b/aps/response.c
@@ -70,7 +70,7 @@ respfinish(struct aps *aps, int fd, char *error)
if (respadd(aps, fd, "ok"))
respfinish(aps, fd, errstr);
} else {
- aps_log(aps, COMMAND, fd, error);
+ aps_logfmt(aps, COMMAND, fd, "error '%s'", error);
aps->clients[fd].resp->buf->len = 0;
if (bufappend(RESP->buf, "error: ", 7) ||
bufappend(RESP->buf, error, strlen(error)) ||