libcoap  4.1.1
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Macros | Functions | Variables
debug.c File Reference
#include "config.h"
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <arpa/inet.h>
#include <time.h>
#include "debug.h"
#include "net.h"

Go to the source code of this file.


#define min(a, b)   ((a) < (b) ? (a) : (b))


coap_log_t coap_get_log_level ()
 Returns the current log level. More...
void coap_set_log_level (coap_log_t level)
 Sets the log level to the specified value. More...
static size_t print_timestamp (char *s, size_t len, coap_tick_t t)
unsigned int print_readable (const unsigned char *data, unsigned int len, unsigned char *result, unsigned int buflen, int encode_always)
size_t coap_print_addr (const struct coap_address_t *addr, unsigned char *buf, size_t len)
void coap_show_pdu (const coap_pdu_t *pdu)
void coap_log_impl (coap_log_t level, const char *format,...)
 Writes the given text to COAP_ERR_FD (for level <= LOG_CRIT) or COAP_DEBUG_FD (for level >= LOG_WARNING). More...


static coap_log_t maxlog = LOG_WARNING
static char * loglevels []

Macro Definition Documentation

#define min (   a,
)    ((a) < (b) ? (a) : (b))

Definition at line 136 of file debug.c.

Function Documentation

coap_log_t coap_get_log_level ( )

Returns the current log level.

Definition at line 41 of file debug.c.

void coap_log_impl ( coap_log_t  level,
const char *  format,

Writes the given text to COAP_ERR_FD (for level <= LOG_CRIT) or COAP_DEBUG_FD (for level >= LOG_WARNING).

The text is output only when level is below or equal to the log level that set by coap_set_log_level().

Definition at line 325 of file debug.c.

size_t coap_print_addr ( const struct coap_address_t *  addr,
unsigned char *  buf,
size_t  len 

Definition at line 140 of file debug.c.

void coap_set_log_level ( coap_log_t  level)

Sets the log level to the specified value.

Definition at line 46 of file debug.c.

void coap_show_pdu ( const coap_pdu_t pdu)

Definition at line 231 of file debug.c.

unsigned int print_readable ( const unsigned char *  data,
unsigned int  len,
unsigned char *  result,
unsigned int  buflen,
int  encode_always 

Definition at line 102 of file debug.c.

static size_t print_timestamp ( char *  s,
size_t  len,
coap_tick_t  t 

Definition at line 58 of file debug.c.

Variable Documentation

char* loglevels[]
Initial value:
= {

Definition at line 51 of file debug.c.

coap_log_t maxlog = LOG_WARNING

Definition at line 38 of file debug.c.