refactor: demote high-frequency debug logs (raw_recv/dispatch→TRACE, normalizer→DEBUG), NTP drift→WARN

This commit is contained in:
Evgeny committed 2026-07-19 13:53:27 +03:00
1 parent 42041dfe84
commit f6f7e12192
6 files changed
+6 -31

No files matched your search

+2 -2
View File
@@ -94,10 +94,10 @@ void etcp_int_recv(struct ll_queue* queue, void* arg) {
struct UTUN_INSTANCE* inst = conn->instance;
if (!inst) { queue_dgram_free(e); queue_entry_free(e); queue_resume_callback(queue); return; }
if (inst->api_bindings.callbacks[id]) {
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "dispatch id=0x%02x conn=%s len=%zu", id, conn->log_name, e->len);
DEBUG_TRACE(DEBUG_CATEGORY_DEBUG, "dispatch id=0x%02x conn=%s len=%zu", id, conn->log_name, e->len);
inst->api_bindings.callbacks[id](conn, e);
} else if (inst->api_bindings.callbacks[0]) {
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "dispatch id=0x%02x (fallback) conn=%s len=%zu", id, conn->log_name, e->len);
DEBUG_TRACE(DEBUG_CATEGORY_DEBUG, "dispatch id=0x%02x (fallback) conn=%s len=%zu", id, conn->log_name, e->len);
inst->api_bindings.callbacks[0](conn, e);
} else { DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "dispatch id=0x%02x NO CB conn=%s len=%zu — DROPPED", id, conn->log_name, e->len); queue_dgram_free(e); queue_entry_free(e); }
queue_resume_callback(queue);
+1 -1
View File
@@ -1532,7 +1532,7 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
return;
}
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "raw_recv on %s from=%s len=%zd", e_sock->name, sockaddr_storage_to_str(&addr).str, recv_len);
DEBUG_TRACE(DEBUG_CATEGORY_DEBUG, "raw_recv on %s from=%s len=%zd", e_sock->name, sockaddr_storage_to_str(&addr).str, recv_len);
// DUMP: Show received packet content
if (debug_should_output(DEBUG_LEVEL_DEBUG, DEBUG_CATEGORY_CRYPTO)) log_dump(DEBUG_LEVEL_DEBUG, DEBUG_CATEGORY_CRYPTO, "RECV in:", data, recv_len);
+1 -1
View File
@@ -263,7 +263,7 @@ static void nat_detection_on_conn_down(struct ETCP_CONN* conn, void* arg) {
static void nat_detection_new_conn_cbk(struct ETCP_CONN* conn, void* arg) {
if (!conn || !conn->instance) return;
struct NAT_DETECTION* nd = (struct NAT_DETECTION*)arg;
DEBUG_INFO(DEBUG_CATEGORY_BGP, "NAT detection set callbacks: %s", conn->log_name);
DEBUG_DEBUG(DEBUG_CATEGORY_NAT, "NAT detection set callbacks: %s", conn->log_name);
etcp_conn_add_up_cbk(conn, nat_detection_on_conn_up, nd);
etcp_conn_add_down_cbk(conn, nat_detection_on_conn_down, nd);
}
+1 -1
View File
@@ -93,7 +93,7 @@ static struct NTP_NODE_PEER* add_peer(struct NTP_NODE_TIME* np, uint64_t node_id
static void check_drift(uint64_t node_id, int64_t offset_us) {
int64_t abs_us = offset_us < 0 ? -offset_us : offset_us;
if (abs_us > NTP_NODE_DRIFT_ERROR_US) {
DEBUG_ERROR(DEBUG_CATEGORY_GENERAL, "NTP_node: clock drift >10s with node %012llx: %lldus",
DEBUG_WARN(DEBUG_CATEGORY_GENERAL, "NTP_node: clock drift >10s with node %012llx: %lldus",
(unsigned long long)node_id, (long long)offset_us);
} else if (abs_us > NTP_NODE_DRIFT_WARN_US) {
DEBUG_WARN(DEBUG_CATEGORY_GENERAL, "NTP_node: clock drift >2s with node %012llx: %lldus",
+1 -1
View File
@@ -242,7 +242,7 @@ static void pn_send_to_etcp(struct PKTNORM* pn) {
frag->ll.dgram_pool = pn->etcp->instance->data_pool;
frag->ll.memlen = pn->etcp->instance->data_pool->object_size;
DEBUG_INFO(DEBUG_CATEGORY_NORMALIZER, "pn->etcp: size=%d memlen=%d frag_size=%d", frag->ll.len, frag->ll.memlen, pn->frag_size);
DEBUG_DEBUG(DEBUG_CATEGORY_NORMALIZER, "pn->etcp: size=%d memlen=%d frag_size=%d", frag->ll.len, frag->ll.memlen, pn->frag_size);
if (debug_should_output(DEBUG_LEVEL_DEBUG, DEBUG_CATEGORY_DUMP)) log_dump(DEBUG_LEVEL_DEBUG, DEBUG_CATEGORY_DUMP, "NORM->ETCP", pn->data, frag->ll.len);
queue_data_put(pn->etcp->input_queue, (struct ll_entry*)frag);