Optimize log output
This commit is contained in:
@@ -88,6 +88,7 @@ int packet_dump_str(const struct packet *pkt, char *buff, int size)
|
||||
used += snprintf(buff + used, size - used, "layer[%u]: %p, proto: %s, header: {offset: %u, ptr: %p, len: %u}, payload: {ptr: %p, len: %u}\n",
|
||||
i, layer, layer_proto_to_str(layer->proto), layer->hdr_offset,
|
||||
layer->hdr_ptr, layer->hdr_len, layer->pld_ptr, layer->pld_len);
|
||||
used += snprintf(buff + used, size - used, " ");
|
||||
old = used;
|
||||
switch (layer->proto)
|
||||
{
|
||||
@@ -140,7 +141,7 @@ int packet_dump_str(const struct packet *pkt, char *buff, int size)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (old != used)
|
||||
if (old != used && i != pkt->layers_used - 1)
|
||||
{
|
||||
used += snprintf(buff + used, size - used, "\n");
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ struct stellar_module *packet_manager_on_init(struct stellar_module_manager *mod
|
||||
}
|
||||
stellar_module_set_ctx(pkt_mgr_mod, pkt_mgr);
|
||||
|
||||
PACKET_MANAGER_LOG_FATAL("packet_manager initialized");
|
||||
PACKET_MANAGER_LOG_FATAL("packet_manager init");
|
||||
return pkt_mgr_mod;
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ void packet_manager_on_exit(struct stellar_module_manager *mod_mgr __attribute__
|
||||
|
||||
packet_manager_free(pkt_mgr);
|
||||
stellar_module_free(mod);
|
||||
PACKET_MANAGER_LOG_FATAL("packet_manager exited");
|
||||
PACKET_MANAGER_LOG_FATAL("packet_manager exit");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -530,7 +530,7 @@ struct stellar_module *session_manager_on_init(struct stellar_module_manager *mo
|
||||
}
|
||||
stellar_module_set_ctx(sess_mgr_mod, sess_mgr);
|
||||
|
||||
SESSION_MANAGER_LOG_FATAL("session_manager initialized");
|
||||
SESSION_MANAGER_LOG_FATAL("session_manager init");
|
||||
return sess_mgr_mod;
|
||||
}
|
||||
|
||||
@@ -542,7 +542,7 @@ void session_manager_on_exit(struct stellar_module_manager *mod_mgr __attribute_
|
||||
|
||||
session_manager_free(sess_mgr);
|
||||
stellar_module_free(mod);
|
||||
SESSION_MANAGER_LOG_FATAL("session_manager exited");
|
||||
SESSION_MANAGER_LOG_FATAL("session_manager exit");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,43 +45,43 @@ static void session_inputs_to_str(int inputs, char *buff, int len)
|
||||
int nused = 0;
|
||||
if (inputs & TCP_SYN)
|
||||
{
|
||||
nused += snprintf(buff + nused, len - nused, "TCP_SYN ");
|
||||
nused += snprintf(buff + nused, len - nused, "TCP_SYN");
|
||||
}
|
||||
if (inputs & TCP_SYN_ACK)
|
||||
{
|
||||
nused += snprintf(buff + nused, len - nused, "TCP_SYN_ACK ");
|
||||
nused += snprintf(buff + nused, len - nused, "TCP_SYN_ACK");
|
||||
}
|
||||
if (inputs & TCP_FIN)
|
||||
{
|
||||
nused += snprintf(buff + nused, len - nused, "TCP_FIN ");
|
||||
nused += snprintf(buff + nused, len - nused, "TCP_FIN");
|
||||
}
|
||||
if (inputs & TCP_RST)
|
||||
{
|
||||
nused += snprintf(buff + nused, len - nused, "TCP_RST ");
|
||||
nused += snprintf(buff + nused, len - nused, "TCP_RST");
|
||||
}
|
||||
if (inputs & TCP_DATA)
|
||||
{
|
||||
nused += snprintf(buff + nused, len - nused, "TCP_DATA ");
|
||||
nused += snprintf(buff + nused, len - nused, "TCP_DATA");
|
||||
}
|
||||
if (inputs & UDP_DATA)
|
||||
{
|
||||
nused += snprintf(buff + nused, len - nused, "UDP_DATA ");
|
||||
nused += snprintf(buff + nused, len - nused, "UDP_DATA");
|
||||
}
|
||||
if (inputs & TIMEOUT)
|
||||
{
|
||||
nused += snprintf(buff + nused, len - nused, "TIMEOUT ");
|
||||
nused += snprintf(buff + nused, len - nused, "TIMEOUT");
|
||||
}
|
||||
if (inputs & LRU_EVICT)
|
||||
{
|
||||
nused += snprintf(buff + nused, len - nused, "LRU_EVICT ");
|
||||
nused += snprintf(buff + nused, len - nused, "LRU_EVICT");
|
||||
}
|
||||
if (inputs & PORT_REUSE_EVICT)
|
||||
{
|
||||
nused += snprintf(buff + nused, len - nused, "PORT_REUSE_EVICT ");
|
||||
nused += snprintf(buff + nused, len - nused, "PORT_REUSE_EVICT");
|
||||
}
|
||||
if (inputs & USER_CLOSE)
|
||||
{
|
||||
nused += snprintf(buff + nused, len - nused, "USER_CLOSE ");
|
||||
nused += snprintf(buff + nused, len - nused, "USER_CLOSE");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user