commit 55b2007ed7b7d2ced7301cb1468cf364b3500ec8
parent 1418e6255c9ead6218fb6559b4bf23d31d0a6ce9
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Sun, 30 Apr 2023 17:16:09 -0700
Add logging statements and player log subject
Diffstat:
3 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/aps/aps.c b/aps/aps.c
@@ -254,6 +254,8 @@ aps_command(struct aps *aps, int fd)
goto exit;
}
+ aps_log(aps, fd, INFO, logsubjects[LogCommand], "running '%s' command", *argv);
+
for (com = NULL, i = 0; com == NULL && i < aps->ncoms; ++i)
if (strcmp(*argv, aps->coms[i].name) == 0)
com = aps->coms[i].func;
diff --git a/aps/log.h b/aps/log.h
@@ -10,6 +10,7 @@ enum logsubject {
LogGeneral,
LogCommand,
LogConn,
+ LogPlayer,
LogQueue,
LogLast,
};
@@ -17,6 +18,7 @@ enum logsubject {
static char *logsubjects[LogLast] = {
[LogCommand] = "command",
[LogConn] = "connection",
+ [LogPlayer] = "player",
[LogQueue] = "queue"
};
diff --git a/aps/main.c b/aps/main.c
@@ -64,6 +64,7 @@ sigchld(int sig)
while ((pid =
waitpid(-1, &status, WCONTINUED | WNOHANG | WUNTRACED)) > 0) {
if (pid == aps->player->pid) {
+ aps_log(aps, 0, INFO, logsubjects[LogPlayer], "player status available");
pupdate(aps->player, status);
kill(getpid(), SIGINT);
}