Various logging improvements

This commit is contained in:
Simon Duquennoy 2018-04-05 05:34:50 -07:00 committed by Simon Duquennoy
parent 9a409bf264
commit 9dfcb2ebb6
7 changed files with 20 additions and 17 deletions

View File

@ -254,7 +254,7 @@ PROCESS_THREAD(slip_radio_process, ev, data)
#ifdef SLIP_RADIO_CONF_SENSORS
SLIP_RADIO_CONF_SENSORS.init();
#endif
printf("Slip Radio started...\n");
LOG_INFO("Slip Radio started\n");
etimer_set(&et, CLOCK_SECOND * 3);

View File

@ -51,7 +51,7 @@
/* Log configuration */
#include "coap-log.h"
#define LOG_MODULE "coap-engine"
#define LOG_MODULE "coap-eng"
#define LOG_LEVEL LOG_LEVEL_COAP
static void process_callback(coap_timer_t *t);

View File

@ -359,8 +359,8 @@ process_secure_data(void)
{
LOG_INFO("receiving secure UDP datagram from [");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO_("]:%u\n Length: %u\n", uip_ntohs(UIP_UDP_BUF->srcport),
uip_datalen());
LOG_INFO_("]:%u\n", uip_ntohs(UIP_UDP_BUF->srcport));
LOG_INFO(" Length: %u\n", uip_datalen());
if(dtls_context) {
dtls_handle_message(dtls_context, (coap_endpoint_t *)get_src_endpoint(1),
@ -374,8 +374,8 @@ process_data(void)
{
LOG_INFO("receiving UDP datagram from [");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO_("]:%u\n Length: %u\n", uip_ntohs(UIP_UDP_BUF->srcport),
uip_datalen());
LOG_INFO_("]:%u\n", uip_ntohs(UIP_UDP_BUF->srcport));
LOG_INFO(" Length: %u\n", uip_datalen());
coap_receive(get_src_endpoint(0), uip_appdata, uip_datalen());
}

View File

@ -1571,7 +1571,7 @@ output(const linkaddr_t *localdest)
LOG_INFO("Fragmentation sending packet len %d\n", uip_len);
/* Create 1st Fragment */
LOG_INFO("output: 1rst fragment ");
LOG_INFO("output: 1st fragment ");
/* Reset last tx status to ok in case the fragment transmissions are deferred */
last_tx_status = MAC_TX_OK;
@ -1591,7 +1591,7 @@ output(const linkaddr_t *localdest)
/* Copy payload and send */
packetbuf_hdr_len += SICSLOWPAN_FRAG1_HDR_LEN;
packetbuf_payload_len = (max_payload - packetbuf_hdr_len) & 0xfffffff8;
LOG_INFO("(len %d, tag %d)\n", packetbuf_payload_len, frag_tag);
LOG_INFO_("(len %d, tag %d)\n", packetbuf_payload_len, frag_tag);
memcpy(packetbuf_ptr + packetbuf_hdr_len,
(uint8_t *)UIP_IP_BUF + uncomp_hdr_len, packetbuf_payload_len);
packetbuf_set_datalen(packetbuf_payload_len + packetbuf_hdr_len);
@ -1636,7 +1636,7 @@ output(const linkaddr_t *localdest)
/* last fragment */
packetbuf_payload_len = uip_len - processed_ip_out_len;
}
LOG_INFO("(offset %d, len %d, tag %d)\n",
LOG_INFO_("(offset %d, len %d, tag %d)\n",
processed_ip_out_len >> 3, packetbuf_payload_len, frag_tag);
memcpy(packetbuf_ptr + packetbuf_hdr_len,
(uint8_t *)UIP_IP_BUF + processed_ip_out_len, packetbuf_payload_len);
@ -1742,7 +1742,7 @@ input(void)
frag_offset = 0;
frag_size = GET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_DISPATCH_SIZE) & 0x07ff;
frag_tag = GET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_TAG);
LOG_INFO("size %d, tag %d, offset %d)\n",
LOG_INFO_ ("size %d, tag %d, offset %d)\n",
frag_size, frag_tag, frag_offset);
packetbuf_hdr_len += SICSLOWPAN_FRAG1_HDR_LEN;
first_fragment = 1;
@ -1767,13 +1767,13 @@ input(void)
frag_offset = PACKETBUF_FRAG_PTR[PACKETBUF_FRAG_OFFSET];
frag_tag = GET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_TAG);
frag_size = GET16(PACKETBUF_FRAG_PTR, PACKETBUF_FRAG_DISPATCH_SIZE) & 0x07ff;
LOG_INFO("size %d, tag %d, offset %d)\n",
LOG_INFO_("size %d, tag %d, offset %d)\n",
frag_size, frag_tag, frag_offset);
packetbuf_hdr_len += SICSLOWPAN_FRAGN_HDR_LEN;
/* If this is the last fragment, we may shave off any extrenous
bytes at the end. We must be liberal in what we accept. */
LOG_INFO("last_fragment?: packetbuf_payload_len %d frag_size %d\n",
LOG_INFO_("last_fragment?: packetbuf_payload_len %d frag_size %d\n",
packetbuf_datalen() - packetbuf_hdr_len, frag_size);
/* Add the fragment to the fragmentation context (this will also

View File

@ -168,6 +168,8 @@ static void
packet_input(void)
{
if(uip_len > 0) {
LOG_INFO("input: received %u bytes\n", uip_len);
check_for_tcp_syn();
#if UIP_TAG_TC_WITH_VARIABLE_RETRANSMISSIONS
@ -499,7 +501,7 @@ get_nexthop(uip_ipaddr_t *addr)
uip_ipaddr_t *nexthop;
uip_ds6_route_t *route;
LOG_INFO("output: processing packet from ");
LOG_INFO("output: processing %u bytes packet from ", uip_len);
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO_(" to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);

View File

@ -523,7 +523,8 @@ csma_output_packet(mac_callback_t sent, void *ptr)
LOG_INFO("sending to ");
LOG_INFO_LLADDR(addr);
LOG_INFO_(", seqno %u, queue length %d, free packets %d\n",
LOG_INFO_(", len %u, seqno %u, queue length %d, free packets %d\n",
packetbuf_datalen(),
packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO),
list_length(n->packet_queue), memb_numfree(&packet_memb));
/* If q is the first packet in the neighbor's queue, send asap */

View File

@ -108,9 +108,9 @@ input_packet(void)
}
#endif /* CSMA_SEND_SOFT_ACK */
if(!duplicate) {
LOG_WARN("received packet from ");
LOG_WARN_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER));
LOG_WARN_(", seqno %u, len %u\n", packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO), packetbuf_datalen());
LOG_INFO("received packet from ");
LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER));
LOG_INFO_(", seqno %u, len %u\n", packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO), packetbuf_datalen());
NETSTACK_NETWORK.input();
}
}