diff --git a/kernel/log.c b/kernel/log.c index a6cb9fe6ec..2b58d47dfb 100644 --- a/kernel/log.c +++ b/kernel/log.c @@ -3,9 +3,13 @@ #include #include #include +#include #if LOG_HANDLER_NSLOG #include #endif +#if LOG_HANDLER_OS_LOG +#include +#endif #include "kernel/calls.h" #include "util/sync.h" #include "util/fifo.h" @@ -142,6 +146,14 @@ static void log_line(const char *line) { extern void NSLog(CFStringRef msg, ...); NSLog(CFSTR("%s"), line); } +#elif LOG_HANDLER_SYSLOG +static void log_line(const char *line) { + syslog(LOG_DEBUG, "%s", line); +} +#elif LOG_HANDLER_OS_LOG +static void log_line(const char *line) { + os_log_fault(OS_LOG_DEFAULT, "%s", line); +} #endif static void default_die_handler(const char *msg) { diff --git a/xX_main_Xx.h b/xX_main_Xx.h index 560b7adf67..d3153cc4ab 100644 --- a/xX_main_Xx.h +++ b/xX_main_Xx.h @@ -2,6 +2,7 @@ #include #include #include +#include #include "kernel/init.h" #include "kernel/fs.h" #include "fs/devices.h" @@ -67,6 +68,8 @@ static inline int xX_main_Xx(int argc, char *const argv[], const char *envp) { } } + openlog(argv[0], 0, LOG_USER); + char root_realpath[MAX_PATH + 1] = "/"; if (root != NULL && realpath(root, root_realpath) == NULL) { perror(root);