debug: Use separate log group for watcher_t

This component produces a lot of messages that make debugging job
handling difficult.
This commit is contained in:
Tobias Brunner
2025-05-27 17:41:02 +02:00
parent 4703ef00ce
commit 2b1f0e8c6e
3 changed files with 15 additions and 11 deletions
+11 -11
View File
@@ -189,7 +189,7 @@ static void update_and_unlock(private_watcher_t *this)
if (error) if (error)
{ {
DBG1(DBG_JOB, "notifying watcher failed: %s", strerror(error)); DBG1(DBG_WCH, "notifying watcher failed: %s", strerror(error));
} }
} }
@@ -251,13 +251,13 @@ static void notify_end(notify_data_t *data)
if (removed) if (removed)
{ {
DBG3(DBG_JOB, "removed fd %d[%s%s] from watcher after callback", data->fd, DBG3(DBG_WCH, "removed fd %d[%s%s] from watcher after callback", data->fd,
data->event & WATCHER_READ ? "r" : "", data->event & WATCHER_READ ? "r" : "",
data->event & WATCHER_WRITE ? "w" : ""); data->event & WATCHER_WRITE ? "w" : "");
} }
else if (updated) else if (updated)
{ {
DBG3(DBG_JOB, "updated fd %d[%s%s] to %d[%s%s] after callback", data->fd, DBG3(DBG_WCH, "updated fd %d[%s%s] to %d[%s%s] after callback", data->fd,
(updated | data->event) & WATCHER_READ ? "r" : "", (updated | data->event) & WATCHER_READ ? "r" : "",
(updated | data->event) & WATCHER_WRITE ? "w" : "", data->fd, (updated | data->event) & WATCHER_WRITE ? "w" : "", data->fd,
updated & WATCHER_READ ? "r" : "", updated & WATCHER_READ ? "r" : "",
@@ -417,7 +417,7 @@ static job_requeue_t watch(private_watcher_t *this)
#if DEBUG_LEVEL >= 3 #if DEBUG_LEVEL >= 3
if (logbuf[0]) if (logbuf[0])
{ {
DBG3(DBG_JOB, "observing fds:%s", logbuf); DBG3(DBG_WCH, "observing fds:%s", logbuf);
} }
#endif #endif
@@ -429,7 +429,7 @@ static job_requeue_t watch(private_watcher_t *this)
ssize_t len; ssize_t len;
job_t *job; job_t *job;
DBG2(DBG_JOB, "watcher is observing %d fds", count-1); DBG2(DBG_WCH, "watcher is observing %d fds", count-1);
thread_cleanup_push((void*)activate_all, this); thread_cleanup_push((void*)activate_all, this);
old = thread_cancelability(TRUE); old = thread_cancelability(TRUE);
@@ -455,14 +455,14 @@ static job_requeue_t watch(private_watcher_t *this)
{ {
if (errno != EAGAIN && errno != EWOULDBLOCK) if (errno != EAGAIN && errno != EWOULDBLOCK)
{ {
DBG1(DBG_JOB, "reading watcher notify failed: %s", DBG1(DBG_WCH, "reading watcher notify failed: %s",
strerror(errno)); strerror(errno));
} }
break; break;
} }
} }
this->pending = FALSE; this->pending = FALSE;
DBG2(DBG_JOB, "watcher got notification, rebuilding"); DBG2(DBG_WCH, "watcher got notification, rebuilding");
break; break;
} }
@@ -506,7 +506,7 @@ static job_requeue_t watch(private_watcher_t *this)
#if DEBUG_LEVEL >= 2 #if DEBUG_LEVEL >= 2
if (logbuf[0]) if (logbuf[0])
{ {
DBG2(DBG_JOB, "events on fds:%s", logbuf); DBG2(DBG_WCH, "events on fds:%s", logbuf);
} }
#endif #endif
@@ -525,7 +525,7 @@ static job_requeue_t watch(private_watcher_t *this)
{ {
if (!this->pending && errno != EINTR) if (!this->pending && errno != EINTR)
{ /* complain only if no pending updates */ { /* complain only if no pending updates */
DBG1(DBG_JOB, "watcher poll() error: %s", strerror(errno)); DBG1(DBG_WCH, "watcher poll() error: %s", strerror(errno));
} }
break; break;
} }
@@ -546,7 +546,7 @@ METHOD(watcher_t, add, void,
.data = data, .data = data,
); );
DBG3(DBG_JOB, "adding fd %d[%s%s] to watcher", fd, DBG3(DBG_WCH, "adding fd %d[%s%s] to watcher", fd,
events & WATCHER_READ ? "r" : "", events & WATCHER_READ ? "r" : "",
events & WATCHER_WRITE ? "w" : ""); events & WATCHER_WRITE ? "w" : "");
@@ -605,7 +605,7 @@ METHOD(watcher_t, remove_, void,
{ {
update_and_unlock(this); update_and_unlock(this);
DBG3(DBG_JOB, "removed fd %d[%s%s] from watcher", fd, DBG3(DBG_WCH, "removed fd %d[%s%s] from watcher", fd,
found & WATCHER_READ ? "r" : "", found & WATCHER_READ ? "r" : "",
found & WATCHER_WRITE ? "w" : ""); found & WATCHER_WRITE ? "w" : "");
} }
+2
View File
@@ -24,6 +24,7 @@ ENUM(debug_names, DBG_DMN, DBG_ANY,
"IKE", "IKE",
"CHD", "CHD",
"JOB", "JOB",
"WCH",
"CFG", "CFG",
"KNL", "KNL",
"NET", "NET",
@@ -46,6 +47,7 @@ ENUM(debug_lower_names, DBG_DMN, DBG_ANY,
"ike", "ike",
"chd", "chd",
"job", "job",
"wch",
"cfg", "cfg",
"knl", "knl",
"net", "net",
+2
View File
@@ -43,6 +43,8 @@ enum debug_t {
DBG_CHD, DBG_CHD,
/** job processing */ /** job processing */
DBG_JOB, DBG_JOB,
/** file descriptor watcher */
DBG_WCH,
/** configuration backends */ /** configuration backends */
DBG_CFG, DBG_CFG,
/** kernel interface */ /** kernel interface */