Logging system: print the module name only on newlines

This commit is contained in:
Simon Duquennoy 2017-06-23 09:21:31 +02:00
parent 395e6dc819
commit a78b4e32e9
20 changed files with 130 additions and 132 deletions

View File

@ -509,7 +509,7 @@ get_nexthop(uip_ipaddr_t *addr)
LOG_INFO("output: looking for next hop for host ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
if(NEXTHOP_NON_STORING(addr)) {
LOG_INFO("output: selected next hop from SRH: ");
@ -537,7 +537,7 @@ get_nexthop(uip_ipaddr_t *addr)
} else {
LOG_INFO("output: no route found, using default route: ");
LOG_INFO_6ADDR(nexthop);
LOG_INFO("\n");
LOG_INFO_("\n");
}
} else {
@ -555,7 +555,7 @@ get_nexthop(uip_ipaddr_t *addr)
} else {
LOG_INFO("output: found next hop from routing table: ");
LOG_INFO_6ADDR(nexthop);
LOG_INFO("\n");
LOG_INFO_("\n");
}
}
@ -628,7 +628,7 @@ send_nd6_ns(uip_ipaddr_t *nexthop)
#else
LOG_ERR("output: neighbor not in cache: ");
LOG_ERR_6ADDR(nexthop);
LOG_ERR("\n");
LOG_ERR_("\n");
#endif
return err;
@ -689,7 +689,7 @@ tcpip_ipv6_output(void)
0, NBR_REACHABLE, NBR_TABLE_REASON_IPV6_ND_AUTOFILL, NULL)) == NULL) {
LOG_ERR("output: failed to autofill neighbor cache for host ");
LOG_ERR_6ADDR(nexthop);
LOG_ERR("\n");
LOG_ERR_("\n");
goto exit;
}
}

View File

@ -610,7 +610,7 @@ uncompress_addr(uip_ipaddr_t *ipaddr, uint8_t const prefix[],
}
LOG_INFO_6ADDR(ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
}
/*--------------------------------------------------------------------*/

View File

@ -109,17 +109,17 @@ uip_ds6_nbr_add(const uip_ipaddr_t *ipaddr, const uip_lladdr_t *lladdr,
#endif /* UIP_ND6_SEND_NS */
LOG_INFO("Adding neighbor with ip addr ");
LOG_INFO_6ADDR(ipaddr);
LOG_INFO(" link addr ");
LOG_INFO_(" link addr ");
LOG_INFO_LLADDR((linkaddr_t*)lladdr);
LOG_INFO(" state %u\n", state);
LOG_INFO_(" state %u\n", state);
NEIGHBOR_STATE_CHANGED(nbr);
return nbr;
} else {
LOG_INFO("Add drop ip addr ");
LOG_INFO_6ADDR(ipaddr);
LOG_INFO(" link addr (%p) ", lladdr);
LOG_INFO_(" link addr (%p) ", lladdr);
LOG_INFO_LLADDR((linkaddr_t*)lladdr);
LOG_INFO(" state %u\n", state);
LOG_INFO_(" state %u\n", state);
return NULL;
}
}
@ -241,7 +241,7 @@ uip_ds6_link_neighbor_callback(int status, int numtx)
stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000);
LOG_INFO("received a link layer ACK : ");
LOG_INFO_LLADDR((uip_lladdr_t *)dest);
LOG_INFO(" is reachable.\n");
LOG_INFO_(" is reachable.\n");
}
}
#endif /* UIP_DS6_LL_NUD */
@ -268,20 +268,20 @@ uip_ds6_neighbor_periodic(void)
if(uip_ds6_defrt_lookup(&nbr->ipaddr) != NULL) {
LOG_INFO("REACHABLE: defrt moving to DELAY (");
LOG_INFO_6ADDR(&nbr->ipaddr);
LOG_INFO(")\n");
LOG_INFO_(")\n");
nbr->state = NBR_DELAY;
stimer_set(&nbr->reachable, UIP_ND6_DELAY_FIRST_PROBE_TIME);
nbr->nscount = 0;
} else {
LOG_INFO("REACHABLE: moving to STALE (");
LOG_INFO_6ADDR(&nbr->ipaddr);
LOG_INFO(")\n");
LOG_INFO_(")\n");
nbr->state = NBR_STALE;
}
#else /* UIP_CONF_IPV6_RPL */
LOG_INFO("REACHABLE: moving to STALE (");
LOG_INFO_6ADDR(&nbr->ipaddr);
LOG_INFO(")\n");
LOG_INFO_(")\n");
nbr->state = NBR_STALE;
#endif /* UIP_CONF_IPV6_RPL */
}

View File

@ -262,7 +262,7 @@ uip_ds6_route_lookup(uip_ipaddr_t *addr)
LOG_INFO("Looking up route for ");
LOG_INFO_6ADDR(addr);
LOG_INFO("\n");
LOG_INFO_("\n");
if(addr == NULL) {
return NULL;
@ -287,9 +287,9 @@ uip_ds6_route_lookup(uip_ipaddr_t *addr)
if(found_route != NULL) {
LOG_INFO("Found route: ");
LOG_INFO_6ADDR(addr);
LOG_INFO(" via ");
LOG_INFO_(" via ");
LOG_INFO_6ADDR(uip_ds6_route_nexthop(found_route));
LOG_INFO("\n");
LOG_INFO_("\n");
} else {
LOG_WARN("No route found\n");
}
@ -331,7 +331,7 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
if(nexthop_lladdr == NULL) {
LOG_WARN("Add: neighbor link-local address unknown for ");
LOG_WARN_6ADDR(nexthop);
LOG_WARN("\n");
LOG_WARN_("\n");
return NULL;
}
@ -348,7 +348,7 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
}
LOG_INFO("Add: old route for ");
LOG_INFO_6ADDR(ipaddr);
LOG_INFO(" found, deleting it\n");
LOG_INFO_(" found, deleting it\n");
uip_ds6_route_rm(r);
}
@ -371,7 +371,7 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
}
LOG_INFO("Add: dropping route to ");
LOG_INFO_6ADDR(&oldest->ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
uip_ds6_route_rm(oldest);
}
@ -452,9 +452,9 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
LOG_INFO("Add: adding route: ");
LOG_INFO_6ADDR(ipaddr);
LOG_INFO(" via ");
LOG_INFO_(" via ");
LOG_INFO_6ADDR(nexthop);
LOG_INFO("\n");
LOG_INFO_("\n");
LOG_ANNOTATE("#L %u 1;blue\n", nexthop->u8[sizeof(uip_ipaddr_t) - 1]);
#if UIP_DS6_NOTIFICATIONS
@ -484,7 +484,7 @@ uip_ds6_route_rm(uip_ds6_route_t *route)
LOG_INFO("Rm: removing route: ");
LOG_INFO_6ADDR(&route->ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
/* Remove the route from the route list */
list_remove(routelist, route);
@ -497,7 +497,7 @@ uip_ds6_route_rm(uip_ds6_route_t *route)
if(neighbor_route == NULL) {
LOG_INFO("Rm: neighbor_route was NULL for ");
LOG_INFO_6ADDR(&route->ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
}
list_remove(route->neighbor_routes->route_list, neighbor_route);
if(list_head(route->neighbor_routes->route_list) == NULL) {
@ -606,12 +606,12 @@ uip_ds6_defrt_add(uip_ipaddr_t *ipaddr, unsigned long interval)
if(d == NULL) {
LOG_ERR("Add default: could not add default route to ");
LOG_ERR_6ADDR(ipaddr);
LOG_ERR(", out of memory\n");
LOG_ERR_(", out of memory\n");
return NULL;
} else {
LOG_INFO("Add default: adding default route to ");
LOG_INFO_6ADDR(ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
}
list_push(defaultrouterlist, d);
@ -699,18 +699,18 @@ uip_ds6_defrt_choose(void)
d = list_item_next(d)) {
LOG_INFO("Default route, IP address ");
LOG_INFO_6ADDR(&d->ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
bestnbr = uip_ds6_nbr_lookup(&d->ipaddr);
if(bestnbr != NULL && bestnbr->state != NBR_INCOMPLETE) {
LOG_INFO("Default route found, IP address ");
LOG_INFO_6ADDR(&d->ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
return &d->ipaddr;
} else {
addr = &d->ipaddr;
LOG_INFO("Default route Incomplete found, IP address ");
LOG_INFO_6ADDR(&d->ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
}
}
return addr;

View File

@ -254,7 +254,7 @@ uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t ipaddrlen,
locprefix->plifetime = ptime;
LOG_INFO("Adding prefix ");
LOG_INFO_6ADDR(&locprefix->ipaddr);
LOG_INFO("length %u, flags %x, Valid lifetime %lx, Preffered lifetime %lx\n",
LOG_INFO_("length %u, flags %x, Valid lifetime %lx, Preffered lifetime %lx\n",
ipaddrlen, flags, vtime, ptime);
return locprefix;
} else {
@ -284,7 +284,7 @@ uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t ipaddrlen,
}
LOG_INFO("Adding prefix ");
LOG_INFO_6ADDR(&locprefix->ipaddr);
LOG_INFO("length %u, vlifetime %lu\n", ipaddrlen, interval);
LOG_INFO_("length %u, vlifetime %lu\n", ipaddrlen, interval);
return locprefix;
}
return NULL;
@ -620,7 +620,7 @@ uip_ds6_dad(uip_ds6_addr_t *addr)
*/
LOG_INFO("DAD succeeded, ipaddr: ");
LOG_INFO_6ADDR(&addr->ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
addr->state = ADDR_PREFERRED;
return;

View File

@ -126,9 +126,9 @@ echo_request_input(void)
*/
LOG_INFO("Received Echo Request from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO(" to ");
LOG_INFO_(" to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
/* IP header */
UIP_IP_BUF->ttl = uip_ds6_if.cur_hop_limit;
@ -171,9 +171,9 @@ echo_request_input(void)
LOG_INFO("Sending Echo Reply to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO(" from ");
LOG_INFO_(" from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
UIP_STAT(++uip_stat.icmp.sent);
return;
}
@ -258,9 +258,9 @@ uip_icmp6_error_output(uint8_t type, uint8_t code, uint32_t param) {
LOG_WARN("Sending ICMPv6 ERROR message type %d code %d to ", type, code);
LOG_WARN_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_WARN(" from ");
LOG_WARN_(" from ");
LOG_WARN_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_WARN("\n");
LOG_WARN_("\n");
return;
}
@ -302,9 +302,9 @@ echo_reply_input(void)
LOG_INFO("Received Echo Reply from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO(" to ");
LOG_INFO_(" to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
uip_ipaddr_copy(&sender, &UIP_IP_BUF->srcipaddr);
ttl = UIP_IP_BUF->ttl;

View File

@ -180,11 +180,11 @@ ns_input(void)
uint8_t flags;
LOG_INFO("Received NS from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO(" to ");
LOG_INFO_(" to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO(" with target address ");
LOG_INFO_(" with target address ");
LOG_INFO_6ADDR((uip_ipaddr_t *) (&UIP_ND6_NS_BUF->tgtipaddr));
LOG_INFO("\n");
LOG_INFO_("\n");
UIP_STAT(++uip_stat.nd6.recv);
#if UIP_CONF_IPV6_CHECKS
@ -346,11 +346,11 @@ create_na:
UIP_STAT(++uip_stat.nd6.sent);
LOG_INFO("Sending NA to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO(" from ");
LOG_INFO_(" from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO(" with target address ");
LOG_INFO_(" with target address ");
LOG_INFO_6ADDR(&UIP_ND6_NA_BUF->tgtipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
return;
discard:
@ -417,11 +417,11 @@ uip_nd6_ns_output(uip_ipaddr_t * src, uip_ipaddr_t * dest, uip_ipaddr_t * tgt)
UIP_STAT(++uip_stat.nd6.sent);
LOG_INFO("Sending NS to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO(" from ");
LOG_INFO_(" from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO(" with target address ");
LOG_INFO_(" with target address ");
LOG_INFO_6ADDR(tgt);
LOG_INFO("\n");
LOG_INFO_("\n");
return;
}
#endif /* UIP_ND6_SEND_NS */
@ -456,11 +456,11 @@ na_input(void)
LOG_INFO("Received NA from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO(" to ");
LOG_INFO_(" to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO(" with target address ");
LOG_INFO_(" with target address ");
LOG_INFO_6ADDR((uip_ipaddr_t *) (&UIP_ND6_NA_BUF->tgtipaddr));
LOG_INFO("\n");
LOG_INFO_("\n");
UIP_STAT(++uip_stat.nd6.recv);
/*
@ -612,9 +612,9 @@ rs_input(void)
LOG_INFO("Received RS from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO(" to ");
LOG_INFO_(" to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
UIP_STAT(++uip_stat.nd6.recv);
@ -800,9 +800,9 @@ uip_nd6_ra_output(uip_ipaddr_t * dest)
UIP_STAT(++uip_stat.nd6.sent);
LOG_INFO("Sending RA to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO(" from ");
LOG_INFO_(" from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
return;
}
#endif /* UIP_ND6_SEND_RA */
@ -842,9 +842,9 @@ uip_nd6_rs_output(void)
UIP_STAT(++uip_stat.nd6.sent);
LOG_INFO("Sending RS to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO(" from ");
LOG_INFO_(" from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
return;
}
/*---------------------------------------------------------------------------*/
@ -864,9 +864,9 @@ ra_input(void)
LOG_INFO("Received RA from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO(" to ");
LOG_INFO_(" to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
UIP_STAT(++uip_stat.nd6.recv);
#if UIP_CONF_IPV6_CHECKS
@ -972,7 +972,7 @@ ra_input(void)
default:
LOG_DBG("Updating timer of prefix ");
LOG_DBG_6ADDR(&prefix->ipaddr);
LOG_DBG(" new value %lu\n", uip_ntohl(nd6_opt_prefix_info->validlt));
LOG_DBG_(" new value %lu\n", uip_ntohl(nd6_opt_prefix_info->validlt));
stimer_set(&prefix->vlifetime,
uip_ntohl(nd6_opt_prefix_info->validlt));
prefix->isinfinite = 0;
@ -997,7 +997,7 @@ ra_input(void)
stimer_remaining(&addr->vlifetime))) {
LOG_DBG("Updating timer of address ");
LOG_DBG_6ADDR(&addr->ipaddr);
LOG_DBG(" new value %lu\n",
LOG_DBG_(" new value %lu\n",
uip_ntohl(nd6_opt_prefix_info->validlt));
stimer_set(&addr->vlifetime,
uip_ntohl(nd6_opt_prefix_info->validlt));
@ -1005,7 +1005,7 @@ ra_input(void)
stimer_set(&addr->vlifetime, 2 * 60 * 60);
LOG_DBG("Updating timer of address ");
LOG_DBG_6ADDR(&addr->ipaddr);
LOG_DBG(" new value %lu\n", (unsigned long)(2 * 60 * 60));
LOG_DBG_(" new value %lu\n", (unsigned long)(2 * 60 * 60));
}
addr->isinfinite = 0;
} else {
@ -1032,9 +1032,9 @@ ra_input(void)
uip_ipaddr_t *ip = (uip_ipaddr_t *)(&UIP_ND6_OPT_RDNSS_BUF->ip);
LOG_DBG("got %d nameservers\n", naddr);
while(naddr-- > 0) {
LOG_DBG(" nameserver: ");
LOG_DBG("nameserver: ");
LOG_DBG_6ADDR(ip);
LOG_DBG(" lifetime: %lx\n", uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
LOG_DBG_(" lifetime: %lx\n", uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
uip_nameserver_update(ip, uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
ip++;
}
@ -1042,7 +1042,7 @@ ra_input(void)
break;
#endif /* UIP_ND6_RA_RDNSS */
default:
LOG_ERR("ND option not supported in RA");
LOG_ERR("ND option not supported in RA\n");
break;
}
nd6_opt_offset += (UIP_ND6_OPT_HDR_BUF->len << 3);

View File

@ -698,9 +698,9 @@ uip_reass(void)
memcpy(FBUF, UIP_IP_BUF, uip_ext_len + UIP_IPH_LEN);
LOG_INFO("src ");
LOG_INFO_6ADDR(&FBUF->srcipaddr);
LOG_INFO("dest ");
LOG_INFO_("dest ");
LOG_INFO_6ADDR(&FBUF->destipaddr);
LOG_INFO("next %d\n", UIP_IP_BUF->proto);
LOG_INFO_("next %d\n", UIP_IP_BUF->proto);
}
@ -1132,9 +1132,9 @@ uip_process(uint8_t flag)
LOG_INFO("packet received from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO(" to ");
LOG_INFO_(" to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
if(uip_is_addr_mcast(&UIP_IP_BUF->srcipaddr)){
UIP_STAT(++uip_stat.ip.drop);
@ -1230,7 +1230,7 @@ uip_process(uint8_t flag)
UIP_IP_BUF->ttl = UIP_IP_BUF->ttl - 1;
LOG_INFO("Forwarding packet to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
UIP_STAT(++uip_stat.ip.forwarded);
goto send;
} else {
@ -1453,7 +1453,6 @@ uip_process(uint8_t flag)
LOG_ERR("Unknown ICMPv6 message type/code %d\n", UIP_ICMP_BUF->type);
UIP_STAT(++uip_stat.icmp.drop);
UIP_STAT(++uip_stat.icmp.typeerr);
LOG_ERR("icmp6: unknown ICMPv6 message.");
uip_clear_buf();
}
@ -2258,9 +2257,9 @@ uip_process(uint8_t flag)
uip_ds6_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr);
LOG_INFO("Sending TCP packet to ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO(" from ");
LOG_INFO_(" from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
if(uip_connr->tcpstateflags & UIP_STOPPED) {
/* If the connection has issued uip_stop(), we advertise a zero

View File

@ -176,7 +176,7 @@ create_frame(int type, int do_create)
LOG_INFO("Out: %2X", params.fcf.frame_type);
LOG_INFO_LLADDR((const linkaddr_t *)params.dest_addr);
LOG_INFO("%d %u (%u)\n", hdr_len, packetbuf_datalen(), packetbuf_totlen());
LOG_INFO_("%d %u (%u)\n", hdr_len, packetbuf_datalen(), packetbuf_totlen());
return hdr_len;
} else {
@ -240,7 +240,7 @@ parse(void)
LOG_INFO("In: %2X", frame.fcf.frame_type);
LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER));
LOG_INFO_LLADDR(packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
LOG_INFO("%d %u (%u)\n", hdr_len, packetbuf_datalen(), packetbuf_totlen());
LOG_INFO_("%d %u (%u)\n", hdr_len, packetbuf_datalen(), packetbuf_totlen());
return hdr_len;
}

View File

@ -362,9 +362,9 @@ tsch_packet_parse_eb(const uint8_t *buf, int buf_size,
frame->fcf.frame_version, frame->fcf.frame_type, buf[0], buf[1]);
LOG_ERR("! parse_eb: frame was from 0x%x/", frame->src_pid);
LOG_ERR_LLADDR((const linkaddr_t *)&frame->src_addr);
LOG_ERR(" to 0x%x/", frame->dest_pid);
LOG_ERR_(" to 0x%x/", frame->dest_pid);
LOG_ERR_LLADDR((const linkaddr_t *)&frame->dest_addr);
LOG_ERR("\n");
LOG_ERR_("\n");
return 0;
}

View File

@ -582,7 +582,7 @@ tsch_associate(const struct input_packet *input_eb, rtimer_clock_t timestamp)
ies.ie_tsch_slotframe_and_link.slotframe_size,
ies.ie_tsch_slotframe_and_link.num_links);
LOG_INFO_LLADDR((const linkaddr_t *)&frame.src_addr);
LOG_INFO("\n");
LOG_INFO_("\n");
return 1;
}

View File

@ -111,7 +111,7 @@ set_global_address(uip_ipaddr_t *prefix, uip_ipaddr_t *iid)
if(uip_ds6_if.addr_list[i].isused &&
(state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
LOG_INFO_6ADDR(&uip_ds6_if.addr_list[i].ipaddr);
printf("\n");
LOG_INFO_("\n");
}
}
}

View File

@ -82,7 +82,7 @@ leave_dag(void)
{
LOG_INFO("leaving DAG \n");
LOG_INFO_6ADDR(&curr_instance.dag.dag_id);
LOG_INFO(", instance %u\n", curr_instance.instance_id);
LOG_INFO_(", instance %u\n", curr_instance.instance_id);
/* Issue a no-path DAO */
RPL_LOLLIPOP_INCREMENT(curr_instance.dag.dao_curr_seqno);
@ -419,7 +419,7 @@ process_dio_join_dag(uip_ipaddr_t *from, rpl_dio_t *dio)
LOG_INFO("joined DAG with instance ID %u, DAG ID ",
curr_instance.instance_id);
LOG_INFO_6ADDR(&curr_instance.dag.dag_id);
LOG_INFO(", rank %u\n", curr_instance.dag.rank);
LOG_INFO_(", rank %u\n", curr_instance.dag.rank);
LOG_ANNOTATE("#A join=%u\n", curr_instance.dag.dag_id.u8[sizeof(curr_instance.dag.dag_id) - 1]);
@ -574,7 +574,7 @@ rpl_dag_init_root(uint8_t instance_id, uip_ipaddr_t *dag_id,
LOG_INFO("created DAG with instance ID %u, DAG ID ",
curr_instance.instance_id);
LOG_INFO_6ADDR(&curr_instance.dag.dag_id);
LOG_INFO(", rank %u\n", curr_instance.dag.rank);
LOG_INFO_(", rank %u\n", curr_instance.dag.rank);
LOG_ANNOTATE("#A root=%u\n", curr_instance.dag.dag_id.u8[sizeof(curr_instance.dag.dag_id) - 1]);
}

View File

@ -194,7 +194,7 @@ rpl_ext_header_srh_update(void)
LOG_INFO("SRH next hop ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
}
uip_ext_len = last_uip_ext_len;
@ -236,7 +236,7 @@ insert_srh_header(void)
LOG_INFO("SRH creating source routing header with destination ");
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
LOG_INFO(" \n");
LOG_INFO_(" \n");
/* Construct source route. We do not do this recursively to keep the runtime stack usage constant. */
@ -286,7 +286,7 @@ insert_srh_header(void)
LOG_INFO("SRH Hop ");
LOG_INFO_6ADDR(&node_addr);
LOG_INFO("\n");
LOG_INFO_("\n");
node = node->parent;
path_len++;
}

View File

@ -125,9 +125,9 @@ rpl_icmp6_update_nbr_table(uip_ipaddr_t *from, nbr_table_reason_t reason, void *
0, NBR_REACHABLE, reason, data)) == NULL) {
LOG_ERR("could not add neighbor to cache ");
LOG_ERR_6ADDR(from);
LOG_ERR(", ");
LOG_ERR_(", ");
LOG_ERR_LLADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER));
LOG_ERR("\n");
LOG_ERR_("\n");
}
}
@ -144,7 +144,7 @@ dis_input(void)
LOG_INFO("received a DIS from ");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
rpl_process_dis(&UIP_IP_BUF->srcipaddr, uip_is_addr_mcast(&UIP_IP_BUF->destipaddr));
@ -169,7 +169,7 @@ rpl_icmp6_dis_output(uip_ipaddr_t *addr)
LOG_INFO("sending a DIS to ");
LOG_INFO_6ADDR(addr);
LOG_INFO("\n");
LOG_INFO_("\n");
uip_icmp6_send(addr, ICMP6_RPL, RPL_CODE_DIS, 2);
}
@ -321,9 +321,9 @@ dio_input(void)
LOG_INFO("received a %s-DIO from ",
uip_is_addr_mcast(&UIP_IP_BUF->destipaddr) ? "multicast" : "unicast");
LOG_INFO_6ADDR(&from);
LOG_INFO(", instance_id %u, DAG ID ", (unsigned)dio.instance_id);
LOG_INFO_(", instance_id %u, DAG ID ", (unsigned)dio.instance_id);
LOG_INFO_6ADDR(&dio.dag_id);
LOG_INFO(", version %u, rank %u\n",
LOG_INFO_(", version %u, rank %u\n",
(unsigned)dio.version,
(unsigned)dio.rank);
@ -451,7 +451,7 @@ rpl_icmp6_dio_output(uip_ipaddr_t *uc_addr)
uc_addr != NULL ? "unicast" : "multicast",
(unsigned)curr_instance.dag.rank);
LOG_INFO_6ADDR(addr);
LOG_INFO("\n");
LOG_INFO_("\n");
uip_icmp6_send(addr, ICMP6_RPL, RPL_CODE_DIO, pos);
}
@ -494,7 +494,7 @@ dao_input(void)
if(memcmp(&curr_instance.dag.dag_id, &buffer[pos], sizeof(curr_instance.dag.dag_id))) {
LOG_ERR("dao_input: different DAG ID ");
LOG_ERR_6ADDR((uip_ipaddr_t *)&buffer[pos]);
LOG_ERR(", discard\n");
LOG_ERR_(", discard\n");
goto discard;
}
pos += 16;
@ -532,11 +532,11 @@ dao_input(void)
/* Destination Advertisement Object */
LOG_INFO("received a %sDAO from ", dao.lifetime == 0 ? "No-path " : "");
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO(", lifetime %u, prefix ", dao.lifetime);
LOG_INFO_(", lifetime %u, prefix ", dao.lifetime);
LOG_INFO_6ADDR(&dao.prefix);
LOG_INFO(", prefix length %u, parent ", dao.prefixlen);
LOG_INFO_(", prefix length %u, parent ", dao.prefixlen);
LOG_INFO_6ADDR(&dao.parent_addr);
LOG_INFO(" \n");
LOG_INFO_(" \n");
rpl_process_dao(&from, &dao);
@ -604,11 +604,11 @@ rpl_icmp6_dao_output(uint8_t lifetime)
lifetime == 0 ? "No-path " : "",
curr_instance.dag.dao_curr_seqno, curr_instance.dag.dao_transmissions, lifetime);
LOG_INFO_6ADDR(prefix);
LOG_INFO(" to ");
LOG_INFO_(" to ");
LOG_INFO_6ADDR(&curr_instance.dag.dag_id);
LOG_INFO(" , parent ");
LOG_INFO_(" , parent ");
LOG_INFO_6ADDR(parent_ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
/* Send DAO to root (IPv6 address is DAG ID) */
uip_icmp6_send(&curr_instance.dag.dag_id, ICMP6_RPL, RPL_CODE_DAO, pos);
@ -638,7 +638,7 @@ dao_ack_input(void)
status < RPL_DAO_ACK_UNABLE_TO_ACCEPT ? "ACK" : "NACK", sequence,
curr_instance.dag.dao_curr_seqno, curr_instance.dag.dao_curr_seqno, status);
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
rpl_process_dao_ack(sequence, status);
@ -663,7 +663,7 @@ rpl_icmp6_dao_ack_output(uip_ipaddr_t *dest, uint8_t sequence, uint8_t status)
LOG_INFO("sending a DAO-%s seqno %d to ",
status < RPL_DAO_ACK_UNABLE_TO_ACCEPT ? "ACK" : "NACK", sequence);
LOG_INFO_6ADDR(dest);
LOG_INFO(" with status %d\n", status);
LOG_INFO_(" with status %d\n", status);
uip_icmp6_send(dest, ICMP6_RPL, RPL_CODE_DAO_ACK, 4);
}

View File

@ -213,18 +213,10 @@ rpl_neighbor_set_preferred(rpl_nbr_t *nbr)
{
if(curr_instance.dag.preferred_parent != nbr) {
LOG_INFO("parent switch ");
if(nbr != NULL) {
LOG_INFO_6ADDR(rpl_neighbor_get_ipaddr(nbr));
} else {
LOG_INFO("NULL");
}
LOG_INFO(" used to be ");
if(curr_instance.dag.preferred_parent != NULL) {
LOG_INFO_6ADDR(rpl_neighbor_get_ipaddr(curr_instance.dag.preferred_parent));
} else {
LOG_INFO("NULL");
}
LOG_INFO("\n");
LOG_INFO_6ADDR(rpl_neighbor_get_ipaddr(nbr));
LOG_INFO_(" used to be ");
LOG_INFO_6ADDR(rpl_neighbor_get_ipaddr(curr_instance.dag.preferred_parent));
LOG_INFO_("\n");
#ifdef RPL_CALLBACK_PARENT_SWITCH
RPL_CALLBACK_PARENT_SWITCH(curr_instance.dag.preferred_parent, nbr);

View File

@ -130,7 +130,7 @@ rpl_ns_update_node(const uip_ipaddr_t *child, const uip_ipaddr_t *parent, uint32
if(child_node == NULL) {
LOG_ERR("NS: no space left for child ");
LOG_ERR_6ADDR(child);
LOG_ERR("\n");
LOG_ERR_("\n");
return NULL;
}
child_node->parent = NULL;
@ -160,9 +160,9 @@ rpl_ns_update_node(const uip_ipaddr_t *child, const uip_ipaddr_t *parent, uint32
LOG_INFO("NS: updating link, child ");
LOG_INFO_6ADDR(child);
LOG_INFO(", parent ");
LOG_INFO_(", parent ");
LOG_INFO_6ADDR(parent);
LOG_INFO(", lifetime %u, num_nodes %u\n", (unsigned)lifetime, num_nodes);
LOG_INFO_(", lifetime %u, num_nodes %u\n", (unsigned)lifetime, num_nodes);
return child_node;
}
@ -224,7 +224,7 @@ rpl_ns_periodic(unsigned seconds)
rpl_ns_get_node_global_addr(&node_addr, l);
LOG_INFO("NS: removing expired node ");
LOG_INFO_6ADDR(&node_addr);
LOG_INFO("\n");
LOG_INFO_("\n");
#endif /* LOG_INFO_ENABLED */
/* No child found, deallocate node */
list_remove(nodelist, l);

View File

@ -122,7 +122,7 @@ rpl_reset_prefix(rpl_prefix_t *last_prefix)
if(rep != NULL) {
LOG_INFO("removing global IP address ");
LOG_INFO_6ADDR(&ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
uip_ds6_addr_rm(rep);
}
curr_instance.dag.prefix_info.length = 0;
@ -150,7 +150,7 @@ rpl_set_prefix_from_addr(uip_ipaddr_t *addr, unsigned len, uint8_t flags)
if(uip_ds6_addr_lookup(&ipaddr) == NULL) {
LOG_INFO("adding global IP address ");
LOG_INFO_6ADDR(&ipaddr);
LOG_INFO("\n");
LOG_INFO_("\n");
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
}
return 1;

View File

@ -49,15 +49,15 @@
/* A list of currently supported modules */
#ifndef RPL_LOG_LEVEL
#define RPL_LOG_LEVEL LOG_LEVEL_NONE /* Only for rpl-lite */
#define RPL_LOG_LEVEL LOG_LEVEL_INFO /* Only for rpl-lite */
#endif /* RPL_LOG_LEVEL */
#ifndef TCPIP_LOG_LEVEL
#define TCPIP_LOG_LEVEL LOG_LEVEL_NONE
#define TCPIP_LOG_LEVEL LOG_LEVEL_WARN
#endif /* TCPIP_LOG_LEVEL */
#ifndef IPV6_LOG_LEVEL
#define IPV6_LOG_LEVEL LOG_LEVEL_NONE
#define IPV6_LOG_LEVEL LOG_LEVEL_WARN
#endif /* IPV6_LOG_LEVEL */
#ifndef SICSLOWPAN_LOG_LEVEL

View File

@ -90,15 +90,17 @@ void uip_debug_ipaddr_print(const uip_ipaddr_t *addr);
#endif /* LOG_CONF_WITH_ANNOTATE */
/* Main log function */
#define LOG(level, ...) do { \
#define LOG(newline, level, ...) do { \
if(level <= LOG_LEVEL) { \
if(LOG_WITH_LOC) { \
LOG_OUTPUT("%s:%d: ", __FILE__, __LINE__); \
if(newline) { \
if(LOG_WITH_LOC) { \
LOG_OUTPUT("%s:%d: ", __FILE__, __LINE__); \
} \
LOG_OUTPUT("%s: ", LOG_MODULE); \
} \
LOG_OUTPUT("%s: ", LOG_MODULE); \
LOG_OUTPUT(__VA_ARGS__); \
} \
} while (0)
} while (0)
/* For Cooja annotations */
#define LOG_ANNOTATE(...) do { \
@ -122,10 +124,15 @@ void uip_debug_ipaddr_print(const uip_ipaddr_t *addr);
} while (0)
/* More compact versions of LOG macros */
#define LOG_ERR(...) LOG(LOG_LEVEL_ERR, __VA_ARGS__)
#define LOG_WARN(...) LOG(LOG_LEVEL_WARN, __VA_ARGS__)
#define LOG_INFO(...) LOG(LOG_LEVEL_INFO, __VA_ARGS__)
#define LOG_DBG(...) LOG(LOG_LEVEL_DBG, __VA_ARGS__)
#define LOG_ERR(...) LOG(1, LOG_LEVEL_ERR, __VA_ARGS__)
#define LOG_WARN(...) LOG(1, LOG_LEVEL_WARN, __VA_ARGS__)
#define LOG_INFO(...) LOG(1, LOG_LEVEL_INFO, __VA_ARGS__)
#define LOG_DBG(...) LOG(1, LOG_LEVEL_DBG, __VA_ARGS__)
#define LOG_ERR_(...) LOG(0, LOG_LEVEL_ERR, __VA_ARGS__)
#define LOG_WARN_(...) LOG(0, LOG_LEVEL_WARN, __VA_ARGS__)
#define LOG_INFO_(...) LOG(0, LOG_LEVEL_INFO, __VA_ARGS__)
#define LOG_DBG_(...) LOG(0, LOG_LEVEL_DBG, __VA_ARGS__)
#define LOG_ERR_LLADDR(...) LOG_LLADDR(LOG_LEVEL_ERR, __VA_ARGS__)
#define LOG_WARN_LLADDR(...) LOG_LLADDR(LOG_LEVEL_WARN, __VA_ARGS__)