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

Change-Id: I00974d7f567ec1d3142727d455549c76ec974a03
laforge/bankd-fsm-mistake
Harald Welte 5 years ago
parent d6dfb8c045
commit ceb3e68fab
  1. 7
      src/bankd_main.c

@ -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));

Loading…
Cancel
Save