logs in docker

This commit is contained in:
Jan-Piet Mens
2023-10-24 11:58:59 +02:00
parent ce65f5c0fd
commit cac38dc11b

13
util.c
View File

@@ -292,8 +292,17 @@ void olog(int level, char *fmt, ...)
utstring_printf_va(u, fmt, ap);
// fprintf(stderr, "+++++ [%s]\n", UB(u));
syslog(level, "%s", UB(u));
/*
* I can't get syslog to do anything when running in docker
* so trying this instead. Inefficient with the getenv() here
* but will have to do for the time being.
*/
if (getenv("DOCKER_RUNNING") != NULL) {
fprintf(stderr, "+ %s\n", UB(u));
} else {
syslog(level, "%s", UB(u));
}
va_end(ap);
}