libcoap  4.0.3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions
debug.h File Reference
#include "config.h"
#include "pdu.h"

Go to the source code of this file.

Macros

#define COAP_DEBUG_FD   stdout
#define COAP_ERR_FD   stderr
#define coap_log(...)   coap_log_impl(__VA_ARGS__)
#define info(...)   coap_log(LOG_INFO, __VA_ARGS__)
#define warn(...)   coap_log(LOG_WARN, __VA_ARGS__)
#define debug(...)   coap_log(LOG_DEBUG, __VA_ARGS__)

Enumerations

enum  coap_log_t {
  LOG_EMERG = 0, LOG_ALERT, LOG_CRIT, LOG_WARN,
  LOG_NOTICE, LOG_INFO, LOG_DEBUG
}
 Pre-defined log levels akin to what is used in syslog. More...

Functions

coap_log_t coap_get_log_level ()
 Returns the current log level.
void coap_set_log_level (coap_log_t level)
 Sets the log level to the specified value.
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_WARN).
void coap_show_pdu (const coap_pdu_t *)
size_t coap_print_addr (const struct __coap_address_t *, unsigned char *, size_t)

Macro Definition Documentation

#define COAP_DEBUG_FD   stdout

Definition at line 15 of file debug.h.

#define COAP_ERR_FD   stderr

Definition at line 19 of file debug.h.

#define coap_log (   ...)    coap_log_impl(__VA_ARGS__)

Definition at line 42 of file debug.h.

#define debug (   ...)    coap_log(LOG_DEBUG, __VA_ARGS__)

Definition at line 50 of file debug.h.

#define info (   ...)    coap_log(LOG_INFO, __VA_ARGS__)

Definition at line 48 of file debug.h.

#define warn (   ...)    coap_log(LOG_WARN, __VA_ARGS__)

Definition at line 49 of file debug.h.

Enumeration Type Documentation

enum coap_log_t

Pre-defined log levels akin to what is used in syslog.

Enumerator:
LOG_EMERG 
LOG_ALERT 
LOG_CRIT 
LOG_WARN 
LOG_NOTICE 
LOG_INFO 
LOG_DEBUG 

Definition at line 23 of file debug.h.

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_WARN).

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 323 of file debug.c.

size_t coap_print_addr ( const struct __coap_address_t ,
unsigned char *  ,
size_t   
)

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 )

Definition at line 229 of file debug.c.