Make UC_LL_NONE work
This commit is contained in:
@@ -71,13 +71,15 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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 {
|
enum UC_LOG_LEVEL {
|
||||||
UC_LL_NONE = 0,
|
|
||||||
UC_LL_DEBUG = 1,
|
UC_LL_DEBUG = 1,
|
||||||
UC_LL_INFO = 3,
|
UC_LL_INFO = 3,
|
||||||
UC_LL_WARNING = 5,
|
UC_LL_WARNING = 5,
|
||||||
UC_LL_ERROR = 7,
|
UC_LL_ERROR = 7,
|
||||||
|
UC_LL_NONE = 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A destination for the logging messages*/
|
/** A destination for the logging messages*/
|
||||||
|
|||||||
+6
-3
@@ -68,14 +68,15 @@ static SLIST_HEAD(, uc_log_destination) g_destinations;
|
|||||||
static int uc_log_reopen_file(struct uc_log_destination *dest);
|
static int uc_log_reopen_file(struct uc_log_destination *dest);
|
||||||
//Uses enum UC_LOG_LEVEL as index
|
//Uses enum UC_LOG_LEVEL as index
|
||||||
static const char *const g_log_levels[] = {
|
static const char *const g_log_levels[] = {
|
||||||
"NONE",
|
"UNKNOWN_0",
|
||||||
"DEBUG",
|
"DEBUG",
|
||||||
"UNKNOWN_2",
|
"UNKNOWN_2",
|
||||||
"INFO",
|
"INFO",
|
||||||
"UNKNOWN_4",
|
"UNKNOWN_4",
|
||||||
"WARNING",
|
"WARNING",
|
||||||
"UNKNOWN_6",
|
"UNKNOWN_6",
|
||||||
"ERROR"
|
"ERROR",
|
||||||
|
"NONE"
|
||||||
};
|
};
|
||||||
|
|
||||||
inline const char *uc_ll_2_str(enum UC_LOG_LEVEL l)
|
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)
|
static inline int uc_ll_2_syslog(enum UC_LOG_LEVEL l)
|
||||||
{
|
{
|
||||||
switch(l) {
|
switch(l) {
|
||||||
case UC_LL_NONE:
|
|
||||||
case UC_LL_DEBUG:
|
case UC_LL_DEBUG:
|
||||||
return LOG_DEBUG;
|
return LOG_DEBUG;
|
||||||
case UC_LL_INFO:
|
case UC_LL_INFO:
|
||||||
@@ -113,6 +113,9 @@ static inline int uc_ll_2_syslog(enum UC_LOG_LEVEL l)
|
|||||||
return LOG_WARNING;
|
return LOG_WARNING;
|
||||||
case UC_LL_ERROR:
|
case UC_LL_ERROR:
|
||||||
return LOG_ERR;
|
return LOG_ERR;
|
||||||
|
case UC_LL_NONE:
|
||||||
|
return LOG_CRIT; //Fishy, but this should never happen
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return LOG_INFO;
|
return LOG_INFO;
|
||||||
|
|||||||
Reference in New Issue
Block a user