ttyd: log to syslog
authorRichard Yu <yurichard3839@gmail.com>
Thu, 28 Nov 2019 13:07:15 +0000 (21:07 +0800)
committerRichard Yu <yurichard3839@gmail.com>
Thu, 28 Nov 2019 18:38:13 +0000 (02:38 +0800)
Signed-off-by: Richard Yu <yurichard3839@gmail.com>
utils/ttyd/Makefile
utils/ttyd/patches/100-log-to-syslog.patch [new file with mode: 0644]

index d2695d3ceff66b5051fe87c4d6b9e3ed791d0a75..8fa6c7ced6d1530fdb937c812d3327d989515c01 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ttyd
 PKG_VERSION:=1.5.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/tsl0922/ttyd/tar.gz/$(PKG_VERSION)?
diff --git a/utils/ttyd/patches/100-log-to-syslog.patch b/utils/ttyd/patches/100-log-to-syslog.patch
new file mode 100644 (file)
index 0000000..3926732
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/server.c
++++ b/src/server.c
+@@ -6,6 +6,7 @@
+ #include <getopt.h>
+ #include <signal.h>
+ #include <sys/stat.h>
++#include <syslog.h>
+ #include <libwebsockets.h>
+ #include <json.h>
+@@ -418,7 +419,8 @@ main(int argc, char **argv) {
+         return -1;
+     }
+-    lws_set_log_level(debug_level, NULL);
++    openlog("ttyd", LOG_NDELAY | LOG_PID, LOG_DAEMON);
++    lws_set_log_level(debug_level, lwsl_emit_syslog);
+ #if LWS_LIBRARY_VERSION_MAJOR >= 2
+     char server_hdr[128] = "";