Make UC_LL_NONE work

This commit is contained in:
Nils O. Selåsdal
2013-06-20 19:55:09 +02:00
parent 012a5b1377
commit 84153e90db
2 changed files with 10 additions and 5 deletions
+4 -2
View File
@@ -71,13 +71,15 @@
extern "C" {
#endif
/** The log levels defined by ucore logging*/
/** The log levels defined by ucore logging
* UC_LL_NONE must not be used in logging statements - but
* can be used to suppress all logging for a destination or module*/
enum UC_LOG_LEVEL {
UC_LL_NONE = 0,
UC_LL_DEBUG = 1,
UC_LL_INFO = 3,
UC_LL_WARNING = 5,
UC_LL_ERROR = 7,
UC_LL_NONE = 9,
};
/** A destination for the logging messages*/
+6 -3
View File
@@ -68,14 +68,15 @@ static SLIST_HEAD(, uc_log_destination) g_destinations;
static int uc_log_reopen_file(struct uc_log_destination *dest);
//Uses enum UC_LOG_LEVEL as index
static const char *const g_log_levels[] = {
"NONE",
"UNKNOWN_0",
"DEBUG",
"UNKNOWN_2",
"INFO",
"UNKNOWN_4",
"WARNING",
"UNKNOWN_6",
"ERROR"
"ERROR",
"NONE"
};
inline const char *uc_ll_2_str(enum UC_LOG_LEVEL l)
@@ -104,7 +105,6 @@ static int uc_str_2_ll(const char *str, size_t len)
static inline int uc_ll_2_syslog(enum UC_LOG_LEVEL l)
{
switch(l) {
case UC_LL_NONE:
case UC_LL_DEBUG:
return LOG_DEBUG;
case UC_LL_INFO:
@@ -113,6 +113,9 @@ static inline int uc_ll_2_syslog(enum UC_LOG_LEVEL l)
return LOG_WARNING;
case UC_LL_ERROR:
return LOG_ERR;
case UC_LL_NONE:
return LOG_CRIT; //Fishy, but this should never happen
}
return LOG_INFO;