Add support for kprintf via syslog() and MacOS os_log().

This seems moderately successful, I was able to get logging out of the
CLI build with syslog().  I may marely have been having trouble with
logging on my Mac.
This commit is contained in:
John Hood
2024-03-07 18:58:54 -05:00
parent eea6921f26
commit cd29315fe4
2 changed files with 15 additions and 0 deletions
+12
View File
@@ -3,9 +3,13 @@
#include <stdarg.h>
#include <string.h>
#include <sys/uio.h>
#include <syslog.h>
#if LOG_HANDLER_NSLOG
#include <CoreFoundation/CoreFoundation.h>
#endif
#if LOG_HANDLER_OS_LOG
#include <os/log.h>
#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) {