diff --git a/src/utils/error.c b/src/utils/error.c
index f4ff99a8def3d847dcabb4143f50192f3e7450c2..f0a48271c91d75b4a60dfb36b6203374887e83a1 100644 (file)
--- a/src/utils/error.c
+++ b/src/utils/error.c
#include <pthread.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <stdio.h>
-#include <string.h>
-
#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
/*
* private data types
typedef struct {
int prio;
sdb_strbuf_t *msg;
- _Bool logged;
+ bool logged;
} sdb_error_ctx_t;
#define SDB_ERROR_INIT { -1, NULL, 1 }
static sdb_error_ctx_t default_error_ctx = SDB_ERROR_INIT;
static pthread_key_t error_ctx_key;
-static _Bool error_ctx_key_initialized = 0;
+static bool error_ctx_key_initialized = 0;
static int (*logger)(int prio, const char *msg) = NULL;
return ctx->prio;
} /* sdb_error_get_prio */
+int
+sdb_error_parse_priority(char *prio)
+{
+ if (! strcasecmp(prio, "EMERG"))
+ return SDB_LOG_EMERG;
+ else if (! strcasecmp(prio, "ERROR"))
+ return SDB_LOG_ERR;
+ else if (! strcasecmp(prio, "WARNING"))
+ return SDB_LOG_WARNING;
+ else if (! strcasecmp(prio, "NOTICE"))
+ return SDB_LOG_NOTICE;
+ else if (! strcasecmp(prio, "INFO"))
+ return SDB_LOG_INFO;
+ else if (! strcasecmp(prio, "DEBUG"))
+ return SDB_LOG_DEBUG;
+ return -1;
+} /* sdb_error_parse_priority */
+
char *
sdb_strerror(int errnum, char *strerrbuf, size_t buflen)
{