helper api:  log through syslog

Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index fda2a95..6113f9b 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -20,6 +20,7 @@
  */
 
 #include "private-libwebsockets.h"
+#include <syslog.h>
 
 #ifdef WIN32
 #include <tchar.h>
@@ -2171,6 +2172,27 @@
 	fprintf(stderr, "%s%s", buf, line);
 }
 
+void lwsl_emit_syslog(int level, const char *line)
+{
+	int syslog_level = LOG_DEBUG;
+
+	switch (level) {
+	case LLL_ERR:
+		syslog_level = LOG_ERR;
+		break;
+	case LLL_WARN:
+		syslog_level = LOG_WARNING;
+		break;
+	case LLL_NOTICE:
+		syslog_level = LOG_NOTICE;
+		break;
+	case LLL_INFO:
+		syslog_level = LOG_INFO;
+		break;
+	}
+	syslog(syslog_level, line);
+}
+
 void _lws_log(int filter, const char *format, ...)
 {
 	char buf[256];