50 #include "contiki-conf.h"
55 #define LOGL_DEFAULT LOGL_WRN
59 uint8_t subl[SUBDOMS];
63 static char *logdomains[LOGD_NUM] = {
71 static char *loglevels[LOGL_NUM] = {
79 static struct log_cfg log_d[LOGD_NUM];
80 static uint8_t inited = 0;
96 if (logdom >= LOGD_NUM)
98 return logdomains[logdom];
115 if (logl >= LOGL_NUM)
117 return loglevels[logl];
136 for(i=0; i<LOGD_NUM; i++) {
137 for(j=0;j<SUBDOMS;j++) {
138 log_d[i].subl[j] = LOGL_DEFAULT;
140 log_d[i].subdom_next = 1;
169 if ((logdom >= LOGD_NUM)||(logl >= LOGL_NUM)||(sdom >= SUBDOMS))
172 log_d[logdom].subl[sdom] = logl;
191 void logging_logfn(uint8_t logdom, uint8_t sdom, uint8_t logl,
const char *fmt, ...)
197 if (logdom >= LOGD_NUM) {
198 printf(
"Unknown log domain %d (", logdom);
205 if (logl >= LOGL_NUM)
209 if (logl >= log_d[logdom].subl[sdom]) {
219 void logging_hexdump(uint8_t *data,
unsigned int len)
223 for (i=0; i < len; i++) {
225 printf(
"\n%02X: ", i);
227 printf(
" %02X", data[i]);