--- l2.h 2001/09/03 12:16:44 1.11
+++ l2.h 2001/09/03 13:43:33 1.12
@@ -61,18 +61,22 @@
typedef struct l2_stream_st l2_stream_t;
typedef struct l2_channel_st l2_channel_t;
-/* list of logging levels */
+/* list of logging levels (high to low priority; low to high amount of logging) */
typedef enum {
- L2_LEVEL_DEBUG,
- L2_LEVEL_TRACE,
- L2_LEVEL_INFO,
- L2_LEVEL_NOTICE,
- L2_LEVEL_WARNING,
- L2_LEVEL_ERROR,
- L2_LEVEL_CRITICAL,
- L2_LEVEL_PANIC
+ L2_LEVEL_PANIC = (1 << 0),
+ L2_LEVEL_CRITICAL = (1 << 1),
+ L2_LEVEL_ERROR = (1 << 2),
+ L2_LEVEL_WARNING = (1 << 3),
+ L2_LEVEL_NOTICE = (1 << 4),
+ L2_LEVEL_INFO = (1 << 5),
+ L2_LEVEL_TRACE = (1 << 6),
+ L2_LEVEL_DEBUG = (1 << 7)
} l2_level_t;
+/* all levels from highest (PANIC) to and including a particular low level */
+#define L2_LEVEL_UPTO(level) \
+ (((level)-1)|(level))
+
/* list of return values */
typedef enum {
L2_OK,
@@ -154,14 +158,14 @@
/* channel operations */
l2_channel_t *l2_channel_create (l2_handler_t *h);
-int l2_channel_configure(l2_channel_t *ch, const char *fmt, ...);
-int l2_channel_open (l2_channel_t *ch);
-int l2_channel_write (l2_channel_t *ch, const char *buf, size_t bufsize);
-int l2_channel_flush (l2_channel_t *ch);
-int l2_channel_close (l2_channel_t *ch);
-int l2_channel_destroy (l2_channel_t *ch);
-l2_channel_t *l2_channel_stack (l2_channel_t *ch1, l2_channel_t *ch2);
-int l2_channel_setparams(l2_param_t p[], const char *fmt, va_list ap);
+l2_result_t l2_channel_configure(l2_channel_t *ch, const char *fmt, ...);
+l2_result_t l2_channel_open (l2_channel_t *ch);
+l2_result_t l2_channel_write (l2_channel_t *ch, const char *buf, size_t bufsize);
+l2_result_t l2_channel_flush (l2_channel_t *ch);
+l2_result_t l2_channel_close (l2_channel_t *ch);
+l2_result_t l2_channel_destroy (l2_channel_t *ch);
+l2_result_t l2_channel_stack (l2_channel_t *ch, l2_channel_t *chTop);
+l2_result_t l2_channel_setparams(l2_param_t p[], const char *fmt, va_list ap);
/* stream operations */
l2_stream_t *l2_stream_create (void);
|