Various logging improvements

This commit is contained in:
Simon Duquennoy 2018-05-14 03:02:12 -07:00
parent 3488a605c0
commit d22ab9413d
3 changed files with 11 additions and 10 deletions

View File

@ -143,7 +143,7 @@ slip_radio_cmd_handler(const uint8_t *data, int len)
packetbuf_clear();
pos = packetutils_deserialize_atts(&data[3], len - 3);
if(pos < 0) {
LOG_ERR("slip-radio: illegal packet attributes\n");
LOG_ERR("illegal packet attributes\n");
return 1;
}
pos += 3;
@ -154,7 +154,7 @@ slip_radio_cmd_handler(const uint8_t *data, int len)
memcpy(packetbuf_dataptr(), &data[pos], len);
packetbuf_set_datalen(len);
LOG_DBG("slip-radio: sending %u (%d bytes)\n",
LOG_DBG("sending %u (%d bytes)\n",
data[2], packetbuf_datalen());
/* parse frame before sending to get addresses, etc. */

View File

@ -1664,11 +1664,12 @@ output(const linkaddr_t *localdest)
}
int freebuf = queuebuf_numfree() - 1;
LOG_INFO("output: fragmentation needed, fragments: %d, free queuebufs: %d\n",
LOG_INFO("output: fragmentation needed, fragments: %u, free queuebufs: %u\n",
fragment_count, freebuf);
if(freebuf < fragment_count) {
LOG_WARN("output: dropping packet, not enough free bufs\n");
LOG_WARN("output: dropping packet, not enough free bufs (needed: %u, free: %u)\n",
fragment_count, freebuf);
return 0;
}

View File

@ -47,7 +47,7 @@
/*---------------------------------------------------------------------------*/
/* Log configuration */
#include "sys/log.h"
#define LOG_MODULE "BR"
#define LOG_MODULE "BR-MAC"
#define LOG_LEVEL LOG_LEVEL_NONE
#define MAX_CALLBACKS 16
@ -112,11 +112,11 @@ send_packet(mac_callback_t sent, void *ptr)
/* Will make it send only DATA packets... for now */
packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, FRAME802154_DATAFRAME);
LOG_INFO("br-rdc: sending packet (%u bytes)\n", packetbuf_datalen());
LOG_INFO("sending packet (%u bytes)\n", packetbuf_datalen());
if(NETSTACK_FRAMER.create() < 0) {
/* Failed to allocate space for headers */
LOG_WARN("br-rdc: send failed, too large header\n");
LOG_WARN("send failed, too large header\n");
mac_call_sent_callback(sent, ptr, MAC_TX_ERR_FATAL, 1);
} else {
/* here we send the data over SLIP to the radio-chip */
@ -125,7 +125,7 @@ send_packet(mac_callback_t sent, void *ptr)
size = packetutils_serialize_atts(&buf[3], sizeof(buf) - 3);
#endif
if(size < 0 || size + packetbuf_totlen() + 3 > sizeof(buf)) {
LOG_WARN("br-rdc: send failed, too large header\n");
LOG_WARN("send failed, too large header\n");
mac_call_sent_callback(sent, ptr, MAC_TX_ERR_FATAL, 1);
} else {
sid = setup_callback(sent, ptr);
@ -146,7 +146,7 @@ static void
packet_input(void)
{
if(NETSTACK_FRAMER.parse() < 0) {
LOG_DBG("br-rdc: failed to parse %u\n", packetbuf_datalen());
LOG_DBG("failed to parse %u\n", packetbuf_datalen());
} else {
NETSTACK_NETWORK.input();
}