feat(log): use syslog logging

This commit is contained in:
2025-12-02 01:12:48 +01:00
parent bc8568f926
commit 115109efb9
4 changed files with 45 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
#include "utils/debug.h"
#include <stdarg.h>
#include <syslog.h>
void cws_log_init(void) {
openlog("cws", LOG_PID | LOG_CONS, LOG_DAEMON);
}
void cws_log_info(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
syslog(LOG_INFO, fmt, args);
va_end(args);
}
void cws_log_error(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
syslog(LOG_ERR, fmt, args);
va_end(args);
}
void cws_log_shutdown(void) {
closelog();
}