Add event-processing logging

This commit is contained in:
Philip Prindeville 2024-01-21 10:55:19 -07:00 committed by Olof Hagsand
parent aca278ccf9
commit 981ea5036d
2 changed files with 9 additions and 8 deletions

View file

@ -64,6 +64,7 @@
#define CLIXON_DBG_NACM 0x000040 /* NACM processing */ #define CLIXON_DBG_NACM 0x000040 /* NACM processing */
#define CLIXON_DBG_PROC 0x000080 /* Process handling */ #define CLIXON_DBG_PROC 0x000080 /* Process handling */
#define CLIXON_DBG_DATASTORE 0x000100 /* Datastore management */ #define CLIXON_DBG_DATASTORE 0x000100 /* Datastore management */
#define CLIXON_DBG_EVENT 0x000200 /* Event processing */
#define CLIXON_DBG_SMASK 0x00ffff /* Subject mask */ #define CLIXON_DBG_SMASK 0x00ffff /* Subject mask */
/* /*

View file

@ -199,7 +199,7 @@ clixon_event_reg_fd(int fd,
e->e_type = EVENT_FD; e->e_type = EVENT_FD;
e->e_next = ee; e->e_next = ee;
ee = e; ee = e;
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "registering %s", e->e_string); clixon_debug(CLIXON_DBG_EVENT | CLIXON_DBG_DETAIL, "registering %s", e->e_string);
return 0; return 0;
} }
@ -293,7 +293,7 @@ clixon_event_reg_timeout(struct timeval t,
} }
e->e_next = e1; e->e_next = e1;
*e_prev = e; *e_prev = e;
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "%s", str); clixon_debug(CLIXON_DBG_EVENT | CLIXON_DBG_DETAIL, "%s", str);
retval = 0; retval = 0;
done: done:
return retval; return retval;
@ -409,7 +409,7 @@ clixon_event_loop(clixon_handle h)
* New select loop is called * New select loop is called
* (3) Other signals result in an error and return -1. * (3) Other signals result in an error and return -1.
*/ */
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "select: %s", strerror(errno)); clixon_debug(CLIXON_DBG_EVENT | CLIXON_DBG_DETAIL, "select: %s", strerror(errno));
if (clixon_exit_get() == 1){ if (clixon_exit_get() == 1){
clixon_err(OE_EVENTS, errno, "select"); clixon_err(OE_EVENTS, errno, "select");
retval = 0; retval = 0;
@ -435,7 +435,7 @@ clixon_event_loop(clixon_handle h)
if (n==0){ /* Timeout */ if (n==0){ /* Timeout */
e = ee_timers; e = ee_timers;
ee_timers = ee_timers->e_next; ee_timers = ee_timers->e_next;
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "timeout: %s", e->e_string); clixon_debug(CLIXON_DBG_EVENT | CLIXON_DBG_DETAIL, "timeout: %s", e->e_string);
if ((*e->e_fn)(0, e->e_arg) < 0){ if ((*e->e_fn)(0, e->e_arg) < 0){
free(e); free(e);
goto err; goto err;
@ -449,9 +449,9 @@ clixon_event_loop(clixon_handle h)
} }
e_next = e->e_next; e_next = e->e_next;
if(e->e_type == EVENT_FD && FD_ISSET(e->e_fd, &fdset)){ if(e->e_type == EVENT_FD && FD_ISSET(e->e_fd, &fdset)){
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "FD_ISSET: %s", e->e_string); clixon_debug(CLIXON_DBG_EVENT | CLIXON_DBG_DETAIL, "FD_ISSET: %s", e->e_string);
if ((*e->e_fn)(e->e_fd, e->e_arg) < 0){ if ((*e->e_fn)(e->e_fd, e->e_arg) < 0){
clixon_debug(CLIXON_DBG_DEFAULT, "Error in: %s", e->e_string); clixon_debug(CLIXON_DBG_EVENT, "Error in: %s", e->e_string);
goto err; goto err;
} }
if (_ee_unreg){ if (_ee_unreg){
@ -463,12 +463,12 @@ clixon_event_loop(clixon_handle h)
clixon_exit_decr(); /* If exit is set and > 1, decrement it (and exit when 1) */ clixon_exit_decr(); /* If exit is set and > 1, decrement it (and exit when 1) */
continue; continue;
err: err:
clixon_debug(CLIXON_DBG_DEFAULT, "err"); clixon_debug(CLIXON_DBG_EVENT, "err");
break; break;
} }
if (clixon_exit_get() == 1) if (clixon_exit_get() == 1)
retval = 0; retval = 0;
clixon_debug(CLIXON_DBG_DEFAULT, "retval:%d", retval); clixon_debug(CLIXON_DBG_EVENT, "retval:%d", retval);
return retval; return retval;
} }