--- l2_test.c 2001/09/09 16:01:43 1.16
+++ l2_test.c 2001/09/10 14:34:11 1.17
@@ -33,6 +33,7 @@
#include <sys/socket.h> /* socket testing only */
#include <netinet/in.h>
#include <netdb.h>
+#include <syslog.h>
#include "l2.h"
@@ -65,6 +66,7 @@
l2_channel_t *chPrefix;
l2_channel_t *chBuf;
l2_channel_t *chFile;
+ l2_channel_t *chSyslog;
#ifdef WITH_SOCKET
l2_channel_t *chSock;
#endif
@@ -88,7 +90,7 @@
die("failed to create socket channel");
if (l2_channel_configure(chSock, "protocol,ipversion,host,port",\
- IPPROTO_UDP, AF_INET, "localhost", 2002) != L2_OK)
+ IPPROTO_TCP, AF_INET, "localhost", 2002) != L2_OK)
die("failed to configure socket ipv4 channel");
#if 0
if (l2_channel_configure(chSock, "protocol,ipversion,host,port",\
@@ -132,6 +134,20 @@
if (l2_stream_channel(st, chPrefix, L2_LEVEL_UPTO(L2_LEVEL_WARNING)) != L2_OK)
die("failed to attach channel stack into stream");
+ if ((chSyslog = l2_channel_create(&l2_handler_syslog)) == NULL) /* Syslog */
+ die("failed to create syslog channel");
+
+ if (l2_channel_configure(chSyslog, "ident,logopts,facility,priority,maskpriority",\
+ "Test", (LOG_PID | LOG_CONS), LOG_USER, (LOG_CRIT|LOG_ALERT|LOG_NOTICE),\
+ 0xFFFFFFFF) != L2_OK)
+ die("failed to configure file channel");
+
+ if (l2_channel_open(chSyslog) != L2_OK)
+ die("failed to open channel stack");
+
+ if (l2_stream_channel(st, chSyslog, L2_LEVEL_UPTO(L2_LEVEL_WARNING)) != L2_OK)
+ die("failed to attach channel syslog into stream");
+
#ifdef WITH_SMTP
if ((chSmtp = l2_channel_create(&l2_handler_smtp)) == NULL) /* SMTP */
die("failed to create smtp channel");
|