chatgui: clean up log — remove spam, move messages to proper categories
A-B: Remove gui_bridge_post_uasync_fn log, MainWindow::onMessageReceived, InputBar send text B1: Move lifecycle messages to GENERAL (utun_node, main, mainwindow, animtimer, sound_manager, messagelist, db_manager) B2: Move chat events to CHAT_SYNC (MSG_RECEIVED, CHANNEL_UPDATED, CHANNEL_PEERS_ONLINE, DB_READY) B3: Move peer/connect events to MEMBER_SYNC (CONNECT_RESULT, NEW_PEER, AUTO_CONNECT, NODE_CHANGED) C: Lower level of C-side spam (recalc, send OK, PUSH ACK, connect_channel) INFO->DEBUG D: Fix duplicate PUSH log line in db_sync.c E: Add debounce to CHANNEL_PEERS_ONLINE — log only on change Misc: Remove sort=0 from ChannelList::loadChannels, improve DB_READY message
This commit is contained in:
1 parent
be0e76c9a6
commit
5feeb2c169
12 files changed
+49
-58
No files matched your search
@@ -55,7 +55,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) {
|
||||
uint64_t author = 0;
|
||||
memcpy(&author, d + 1 + chLen, 8);
|
||||
QString chId = QString::fromUtf8((const char*)d + 1, chLen);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: MSG_RECEIVED ch=%s author=%llu",
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "gui_bridge: MSG_RECEIVED ch=%s author=%llu",
|
||||
qPrintable(chId), (unsigned long long)author);
|
||||
if (g_msg_received_cb) g_msg_received_cb((const char*)d + 1, chLen, author);
|
||||
} else {
|
||||
@@ -69,7 +69,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) {
|
||||
if (dlen >= 20) {
|
||||
uint64_t nodeId, channelId; int result;
|
||||
memcpy(&nodeId, d, 8); memcpy(&result, d + 8, 4); memcpy(&channelId, d + 12, 8);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: CONNECT_RESULT node=0x%016llx ch=%llu result=%d",
|
||||
DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "gui_bridge: CONNECT_RESULT node=0x%016llx ch=%llu result=%d",
|
||||
(unsigned long long)nodeId, (unsigned long long)channelId, result);
|
||||
if (g_connect_result_cb) g_connect_result_cb(nodeId, channelId, result);
|
||||
} else {
|
||||
@@ -79,7 +79,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) {
|
||||
case GUI_EVT_NEW_PEER:
|
||||
if (dlen >= 8) {
|
||||
uint64_t nodeId; memcpy(&nodeId, d, 8);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: NEW_PEER node=0x%016llx", (unsigned long long)nodeId);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "gui_bridge: NEW_PEER node=0x%016llx", (unsigned long long)nodeId);
|
||||
} else {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: NEW_PEER data too short %d", dlen);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) {
|
||||
uint8_t chLen = d[0];
|
||||
if (dlen >= 1 + chLen) {
|
||||
QString chId = QString::fromUtf8((const char*)d + 1, chLen);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: CHANNEL_UPDATED ch=%s", qPrintable(chId));
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "gui_bridge: CHANNEL_UPDATED ch=%s", qPrintable(chId));
|
||||
if (g_channel_updated_cb) g_channel_updated_cb((const char*)d + 1, chLen);
|
||||
}
|
||||
} else {
|
||||
@@ -118,7 +118,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) {
|
||||
uint16_t node_count; memcpy(&node_count, d + 3, 2);
|
||||
uint16_t connected; memcpy(&connected, d + 5, 2);
|
||||
const char* st_str = status == 0 ? "in_progress" : status == 1 ? "done" : "stopped";
|
||||
if (status != 0) DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: AUTO_CONNECT %s tried=%u/%u connected=%u", st_str, total_tried, node_count, connected);
|
||||
if (status != 0) DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "gui_bridge: AUTO_CONNECT %s tried=%u/%u connected=%u", st_str, total_tried, node_count, connected);
|
||||
if (g_auto_connect_status_cb) g_auto_connect_status_cb(status, total_tried, node_count, connected);
|
||||
}
|
||||
break;
|
||||
@@ -127,13 +127,19 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) {
|
||||
uint8_t chLen = d[0];
|
||||
if (dlen >= 3 + chLen) {
|
||||
uint16_t online; memcpy(&online, d + 1 + chLen, 2);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: CHANNEL_PEERS_ONLINE ch=%.*s online=%u", chLen, (const char*)d + 1, online);
|
||||
static char lastChId[256] = {0};
|
||||
static uint16_t lastOnline = 0xFFFF;
|
||||
if (chLen != (uint8_t)strlen(lastChId) || memcmp(lastChId, d + 1, chLen) != 0 || online != lastOnline) {
|
||||
memcpy(lastChId, d + 1, chLen); lastChId[chLen] = '\0';
|
||||
lastOnline = online;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "gui_bridge: CHANNEL_PEERS_ONLINE ch=%.*s online=%u", chLen, (const char*)d + 1, online);
|
||||
}
|
||||
if (g_channel_peers_online_cb) g_channel_peers_online_cb((const char*)d + 1, chLen, online);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GUI_EVT_DB_READY:
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: DB_READY");
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "gui_bridge: DB_READY (chat DB tables created)");
|
||||
if (g_db_ready_cb) g_db_ready_cb();
|
||||
break;
|
||||
case GUI_EVT_STATUS_REFRESH:
|
||||
@@ -142,7 +148,7 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) {
|
||||
case GUI_EVT_NODE_CHANGED:
|
||||
if (dlen >= 8) {
|
||||
uint64_t nodeId; memcpy(&nodeId, d, 8);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge: NODE_CHANGED node=0x%016llx — pubkey changed, connection closed", (unsigned long long)nodeId);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "gui_bridge: NODE_CHANGED node=0x%016llx — pubkey changed, connection closed", (unsigned long long)nodeId);
|
||||
} else {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "gui_bridge: NODE_CHANGED data too short %d", dlen);
|
||||
}
|
||||
@@ -213,7 +219,6 @@ void gui_bridge_post_uasync_fn(void (*fn)(void*), void* arg) {
|
||||
}
|
||||
if (!fn) return;
|
||||
uasync_post(g_ua, fn, arg);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "gui_bridge_post_uasync_fn: posted fn=%p arg=%p", (void*)fn, arg);
|
||||
}
|
||||
|
||||
int gui_bridge_is_uasync_ready(void) {
|
||||
|
||||
Reference in new issue
Block a user