mirror of
https://salsa.debian.org/ha-team/libqb
synced 2026-08-09 22:49:43 +00:00
LOG: fix mapping from priority to name
Remove qb_log_priority_name_get() as we have the formatting. Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
191b71a8b7
commit
e390613036
@ -154,12 +154,6 @@ void qb_log_from_external_source(const char *function,
|
||||
#define qb_perror
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Utility function to get the priority name from it's ID
|
||||
* like this: LOG_ERR - > "error"
|
||||
*/
|
||||
const char *qb_log_priority_name_get(uint32_t priority);
|
||||
|
||||
#define QB_LOG_SYSLOG 0
|
||||
#define QB_LOG_STDERR 1
|
||||
#define QB_LOG_BLACKBOX 2
|
||||
|
||||
21
lib/log.c
21
lib/log.c
@ -54,30 +54,17 @@ struct syslog_names {
|
||||
|
||||
struct syslog_names prioritynames[] =
|
||||
{
|
||||
{ "emerg", LOG_EMERG },
|
||||
{ "alert", LOG_ALERT },
|
||||
{ "crit", LOG_CRIT },
|
||||
{ "debug", LOG_DEBUG },
|
||||
{ "emerg", LOG_EMERG },
|
||||
{ "err", LOG_ERR },
|
||||
{ "error", LOG_ERR },
|
||||
{ "info", LOG_INFO },
|
||||
{ "notice", LOG_NOTICE },
|
||||
{ "warning", LOG_WARNING },
|
||||
{ "notice", LOG_NOTICE },
|
||||
{ "info", LOG_INFO },
|
||||
{ "debug", LOG_DEBUG },
|
||||
{ NULL, -1 }
|
||||
};
|
||||
|
||||
const char *qb_log_priority_name_get(uint32_t priority)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; prioritynames[i].c_name != NULL; i++) {
|
||||
if (priority == prioritynames[i].c_val) {
|
||||
return prioritynames[i].c_name;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char log_month_name[][4] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
|
||||
@ -93,7 +93,6 @@ static const char *my_tags_stringify(uint32_t tags)
|
||||
} else {
|
||||
return "MAIN";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int32_t main(int32_t argc, char *argv[])
|
||||
@ -171,8 +170,8 @@ int32_t main(int32_t argc, char *argv[])
|
||||
qb_log_thread_start();
|
||||
}
|
||||
qb_log(LOG_DEBUG, 0, "hello");
|
||||
qb_log(LOG_INFO, 0, "hello");
|
||||
qb_log(LOG_NOTICE, 0, "hello");
|
||||
qb_log(LOG_INFO, 0, "this is an info");
|
||||
qb_log(LOG_NOTICE, 0, "hello - notice?");
|
||||
func_one();
|
||||
func_two();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user