bankd: Include worker state and file/line in LOGW output

Change-Id: I00974d7f567ec1d3142727d455549c76ec974a03
This commit is contained in:
Harald Welte 2018-08-16 14:47:11 +02:00
parent d6dfb8c045
commit ceb3e68fab
1 changed files with 4 additions and 3 deletions

View File

@ -116,9 +116,6 @@ if (rv != SCARD_S_SUCCESS) { \
printf(text ": OK\n\n"); \
}
#define LOGW(w, fmt, args...) \
printf("[%u] " fmt, (w)->num, args)
struct value_string worker_state_names[] = {
{ BW_ST_INIT, "INIT" },
{ BW_ST_ACCEPTING, "ACCEPTING" },
@ -129,6 +126,10 @@ struct value_string worker_state_names[] = {
{ 0, NULL }
};
#define LOGW(w, fmt, args...) \
printf("[%03u %s] %s:%u " fmt, (w)->num, get_value_string(worker_state_names, (w)->state), \
__FILE__, __LINE__, ## args)
static void worker_set_state(struct bankd_worker *worker, enum bankd_worker_state new_state)
{
LOGW(worker, "Changing state to %s\n", get_value_string(worker_state_names, new_state));