Skip to content

Commit 9ee24d0

Browse files
committed
Internal - More log details
1 parent 897a440 commit 9ee24d0

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

src/webui.c

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,7 @@ size_t webui_bind(size_t window, const char* element, void(*func)(webui_event_t*
18911891
win->has_all_events = true;
18921892
win->cb[index] = func;
18931893
#ifdef WEBUI_LOG
1894-
printf("[User] webui_bind() -> Save bind (all events) at %zu\n", index);
1894+
printf("[User] webui_bind() -> Save bind (all events) index %zu, address 0x%p\n", index, func);
18951895
#endif
18961896
}
18971897
return index;
@@ -1902,7 +1902,7 @@ size_t webui_bind(size_t window, const char* element, void(*func)(webui_event_t*
19021902
if (func != NULL) {
19031903
win->cb[index] = func;
19041904
#ifdef WEBUI_LOG
1905-
printf("[User] webui_bind() -> Save bind at %zu\n", index);
1905+
printf("[User] webui_bind() -> Save bind index %zu, address 0x%p\n", index, func);
19061906
#endif
19071907

19081908
// Send to all connected clients the new binding ID
@@ -3761,7 +3761,7 @@ static void _webui_interface_bind_handler_all(webui_event_t* e) {
37613761
#endif
37623762
// Call all-events cb
37633763
#ifdef WEBUI_LOG
3764-
printf("[Core]\t\t_webui_interface_bind_handler_all() -> Calling user all-events callback\n[Call]\n");
3764+
printf("[Core]\t\t_webui_interface_bind_handler_all() -> Calling user all-events callback at address 0x%p\n[Call]\n", win->cb_interface[events_cb_index]);
37653765
#endif
37663766
win->cb_interface[events_cb_index](e->window, e->event_type, e->element, e->event_number, e->bind_id);
37673767
}
@@ -3799,7 +3799,7 @@ static void _webui_interface_bind_handler(webui_event_t* e) {
37993799
#endif
38003800
// Call cb
38013801
#ifdef WEBUI_LOG
3802-
printf("[Core]\t\t_webui_interface_bind_handler() -> Calling user callback\n[Call]\n");
3802+
printf("[Core]\t\t_webui_interface_bind_handler() -> Calling user callback at address 0x%p\n[Call]\n", win->cb_interface[cb_index]);
38033803
#endif
38043804
win->cb_interface[cb_index](e->window, e->event_type, e->element, e->event_number, e->bind_id);
38053805
}
@@ -3811,6 +3811,9 @@ static void _webui_interface_bind_handler(webui_event_t* e) {
38113811

38123812
// Async response wait
38133813
if (_webui.config.asynchronous_response) {
3814+
#ifdef WEBUI_LOG
3815+
printf("[Core]\t\t_webui_interface_bind_handler() -> Waiting for asynchronous response...\n");
3816+
#endif
38143817
bool done = false;
38153818
while (!done) {
38163819
_webui_sleep(10);
@@ -4020,7 +4023,7 @@ void webui_interface_set_response_file_handler(size_t window, const void* respon
40204023
bool webui_interface_is_app_running(void) {
40214024

40224025
#ifdef WEBUI_LOG
4023-
// printf("[User] webui_is_app_running()\n");
4026+
// printf("[User] webui_interface_is_app_running()\n");
40244027
#endif
40254028

40264029
// Stop if already flagged
@@ -4041,7 +4044,7 @@ bool webui_interface_is_app_running(void) {
40414044

40424045
#ifdef WEBUI_LOG
40434046
if (!app_is_running)
4044-
printf("[User] webui_is_app_running() -> App Stopped\n");
4047+
printf("[User] webui_interface_is_app_running() -> App Stopped\n");
40454048
#endif
40464049

40474050
return app_is_running;
@@ -4851,7 +4854,8 @@ static int _webui_external_file_handler(_webui_window_t* win, struct mg_connecti
48514854
// Files handler callback
48524855
#ifdef WEBUI_LOG
48534856
printf("[Core]\t\t_webui_external_file_handler() -> Path [%s]\n", url);
4854-
printf("[Core]\t\t_webui_external_file_handler() -> Calling custom files handler callback\n");
4857+
printf("[Core]\t\t_webui_external_file_handler() -> Calling custom files handler callback at address 0x%p\n",
4858+
(win->files_handler_window != NULL ? win->files_handler_window : win->files_handler));
48554859
printf("[Call]\n");
48564860
#endif
48574861

@@ -4874,6 +4878,9 @@ static int _webui_external_file_handler(_webui_window_t* win, struct mg_connecti
48744878
if (_webui.config.asynchronous_response) {
48754879
// `callback_resp` is NULL now, we need to
48764880
// wait for the response that will come later.
4881+
#ifdef WEBUI_LOG
4882+
printf("[Core]\t\t_webui_external_file_handler() -> Waiting for asynchronous response...\n");
4883+
#endif
48774884
bool done = false;
48784885
while (!done) {
48794886
_webui_sleep(10);
@@ -8393,7 +8400,7 @@ static void _webui_window_event(
83938400
if (exist && win->cb[events_cb_index] != NULL) {
83948401
// Call user all-events cb
83958402
#ifdef WEBUI_LOG
8396-
printf("[Core]\t\t_webui_window_event() -> Calling all-events user callback\n");
8403+
printf("[Core]\t\t_webui_window_event() -> Calling all-events user callback at address 0x%p\n", win->cb[events_cb_index]);
83978404
printf("[Call]\n");
83988405
#endif
83998406
e.bind_id = events_cb_index;
@@ -8409,7 +8416,7 @@ static void _webui_window_event(
84098416
if (exist && win->cb[cb_index] != NULL) {
84108417
// Call user cb
84118418
#ifdef WEBUI_LOG
8412-
printf("[Core]\t\t_webui_window_event() -> Calling user callback\n");
8419+
printf("[Core]\t\t_webui_window_event() -> Calling user callback at address 0x%p\n", win->cb[cb_index]);
84138420
printf("[Call]\n");
84148421
#endif
84158422
e.bind_id = cb_index;
@@ -8424,6 +8431,9 @@ static void _webui_window_event(
84248431

84258432
// Async response wait
84268433
if (_webui.config.asynchronous_response) {
8434+
#ifdef WEBUI_LOG
8435+
printf("[Core]\t\t_webui_window_event() -> Waiting for asynchronous response...\n");
8436+
#endif
84278437
bool done = false;
84288438
while (!done) {
84298439
_webui_sleep(10);
@@ -10487,15 +10497,18 @@ static void _webui_ws_process(
1048710497
// Call user cb
1048810498
#ifdef WEBUI_LOG
1048910499
printf(
10490-
"[Core]\t\t_webui_ws_process(%zu) -> Calling user callback\n[Call]\n",
10491-
recvNum
10500+
"[Core]\t\t_webui_ws_process(%zu) -> Calling user callback at address 0x%p\n[Call]\n",
10501+
recvNum, win->cb[cb_index]
1049210502
);
1049310503
#endif
1049410504
e.bind_id = cb_index;
1049510505
win->cb[cb_index](&e);
1049610506

1049710507
// Async response wait
1049810508
if (_webui.config.asynchronous_response) {
10509+
#ifdef WEBUI_LOG
10510+
printf("[Core]\t\t_webui_ws_process(%zu) -> Waiting for asynchronous response...\n", recvNum);
10511+
#endif
1049910512
bool done = false;
1050010513
while (!done) {
1050110514
_webui_sleep(10);

0 commit comments

Comments
 (0)