kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 20e2447c902bb5460dabb3f019c8b35d4ebf5951
parent ef49a0d4e10ea714c64c7d415823e549b98708ff
Author: Joris Vink <joris@coders.se>
Date:   Thu, 31 Jul 2014 14:26:51 +0200

When running Kore in foreground mode, log to stdout

Diffstat:
src/utils.c | 18+++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/utils.c b/src/utils.c @@ -55,7 +55,8 @@ kore_debug_internal(char *file, int line, const char *fmt, ...) void kore_log_init(void) { - openlog("kore", LOG_NDELAY | LOG_PID, LOG_DAEMON); + if (!foreground) + openlog("kore", LOG_NDELAY | LOG_PID, LOG_DAEMON); } void @@ -68,10 +69,17 @@ kore_log(int prio, const char *fmt, ...) (void)vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); - if (worker != NULL) - syslog(prio, "[wrk %d]: %s", worker->id, buf); - else - syslog(prio, "[parent]: %s", buf); + if (worker != NULL) { + if (foreground) + printf("[wrk %d]: %s\n", worker->id, buf); + else + syslog(prio, "[wrk %d]: %s", worker->id, buf); + } else { + if (foreground) + printf("[parent]: %s\n", buf); + else + syslog(prio, "[parent]: %s", buf); + } } void