--- l2_test.c 2001/09/04 19:35:20 1.11
+++ l2_test.c 2001/09/05 13:56:43 1.12
@@ -62,6 +62,7 @@
int main(int argc, char *argv[])
{
+ l2_channel_t *chPrefix;
l2_channel_t *chBuf;
l2_channel_t *chFile;
l2_channel_t *chSock;
@@ -94,6 +95,13 @@
if (l2_stream_channel(st, chSock, L2_LEVEL_UPTO(L2_LEVEL_WARNING)) != L2_OK)
die("failed to attach first channel into stream");
*/
+
+ if ((chPrefix = l2_channel_create(&l2_handler_prefix)) == NULL) /* Prefix */
+ die("failed to create prefix channel");
+
+ if (l2_channel_configure(chPrefix, "timefmt,timezone", "[%d-%m-%Y/%H:%M:%S] ", "local") != L2_OK)
+ die("failed to configure prefix channel");
+
if ((chBuf = l2_channel_create(&l2_handler_buffer)) == NULL) /* Buffer */
die("failed to create buffer channel");
@@ -108,12 +116,15 @@
if (l2_channel_stack(chFile, chBuf) != L2_OK)
die("failed to stack buffer channel on top of file channel");
+
+ if (l2_channel_stack(chBuf, chPrefix) != L2_OK)
+ die("failed to stack prefix channel on top of buffer channel");
- if (l2_channel_open(chBuf) != L2_OK)
- die("failed to open buffer channel");
+ if (l2_channel_open(chPrefix) != L2_OK)
+ die("failed to open channel stack");
- if (l2_stream_channel(st, chBuf, L2_LEVEL_UPTO(L2_LEVEL_WARNING)) != L2_OK)
- die("failed to attach second channel into stream");
+ if (l2_stream_channel(st, chPrefix, L2_LEVEL_UPTO(L2_LEVEL_WARNING)) != L2_OK)
+ die("failed to attach channel stack into stream");
if (l2_stream_levels(st, L2_LEVEL_UPTO(L2_LEVEL_WARNING)) != L2_OK)
die("failed to set global logging level");
|