--- l2_test.c 2001/11/04 13:21:17 1.38
+++ l2_test.c 2001/11/04 14:08:24 1.39
@@ -57,6 +57,7 @@
int main(int argc, char *argv[])
{
+ l2_channel_t *ch;
l2_channel_t *chFilter;
l2_channel_t *chPrefix;
l2_channel_t *chBuffer;
@@ -73,6 +74,10 @@
if (l2_env_formatter(env, 'S', l2_util_fmt_dump, NULL) != L2_OK)
die("failed to configure formatter for %%S");
+ /* create nop channel */
+ if ((l2_channel_create(&ch, env, &l2_handler_nop)) != L2_OK)
+ die("failed to create nop channel");
+
/* create prefix channel */
if ((l2_channel_create(&chPrefix, env, &l2_handler_prefix)) != L2_OK)
die("failed to create prefix channel");
@@ -118,28 +123,28 @@
die("failed to level of smtp channel");
/* build channel tree */
- if (l2_channel_link(chFilter, L2_LINK_CHILDS, chPrefix, chBuffer, chFile, NULL) != L2_OK)
+ if (l2_channel_link(ch, L2_LINK_CHILDS, chFilter, chPrefix, chBuffer, chFile, NULL) != L2_OK)
die("failed to link channels together as a child sequence");
- if (l2_channel_link(chFilter, L2_LINK_SIBLINGS, chSyslog, NULL) != L2_OK)
+ if (l2_channel_link(ch, L2_LINK_SIBLINGS, chSyslog, NULL) != L2_OK)
die("failed to link filter channel on top of syslog channel");
/* open channel tree */
- if (l2_channel_open(chFilter) != L2_OK)
+ if (l2_channel_open(ch) != L2_OK)
die("failed to open channel tree");
/* perform a few log operations */
- if (l2_channel_log(chFilter, L2_LEVEL_PANIC, "1: Checking localhost %s %{myparm}k <%{text}S><%{hex}S><%{base64}S>\n", "foo", 12345, "foo\1bar", 7, "foo\1bar", 7, "foo\1bar", 7) != L2_OK)
+ if (l2_channel_log(ch, L2_LEVEL_PANIC, "1: Checking localhost %s %{myparm}k <%{text}S><%{hex}S><%{base64}S>\n", "foo", 12345, "foo\1bar", 7, "foo\1bar", 7, "foo\1bar", 7) != L2_OK)
die("failed to log message #1 to channel");
- if (l2_channel_log(chFilter, L2_LEVEL_PANIC, "2: Shecking\n") != L2_OK)
+ if (l2_channel_log(ch, L2_LEVEL_PANIC, "2: Shecking\n") != L2_OK)
die("failed to log message #2 to channel");
- if (l2_channel_log(chFilter, L2_LEVEL_PANIC, "3: Checking localhost %s %{myparm}k <%{text}S><%{hex}S><%{base64}S>\n", "foo", 12345, "foo\1bar", 7, "foo\1bar", 7, "foo\1bar", 7) != L2_OK)
+ if (l2_channel_log(ch, L2_LEVEL_PANIC, "3: Checking localhost %s %{myparm}k <%{text}S><%{hex}S><%{base64}S>\n", "foo", 12345, "foo\1bar", 7, "foo\1bar", 7, "foo\1bar", 7) != L2_OK)
die("failed to log message #3 to channel");
- if (l2_channel_log(chFilter, L2_LEVEL_PANIC, "4: Shecking\n") != L2_OK)
+ if (l2_channel_log(ch, L2_LEVEL_PANIC, "4: Shecking\n") != L2_OK)
die("failed to log message #4 to channel");
/* destroy channel tree */
- if (l2_channel_destroy(chFilter) != L2_OK)
- die("failed to destroy stream");
+ if (l2_channel_destroy(ch) != L2_OK)
+ die("failed to destroy channel tree");
return 0;
}
|