libcoap  4.1.2
Macros | Enumerations | Functions
debug.h File Reference
#include "pdu.h"
Include dependency graph for debug.h:
This graph shows which files directly or indirectly include this file:

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_WARNING, __VA_ARGS__)
 
#define debug(...)   coap_log(LOG_DEBUG, __VA_ARGS__)
 

Enumerations

enum  coap_log_t {
  LOG_EMERG =0, LOG_ALERT, LOG_CRIT, LOG_ERR,
  LOG_WARNING, 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 (void)
 Returns the current log level. More...
 
void coap_set_log_level (coap_log_t level)
 Sets the log level to the specified value. More...
 
const char * coap_package_name (void)
 Returns a zero-terminated string with the name of this library. More...
 
const char * coap_package_version (void)
 Returns a zero-terminated string with the library version. More...
 
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...
 
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

§ COAP_DEBUG_FD

#define COAP_DEBUG_FD   stdout

Definition at line 14 of file debug.h.

§ COAP_ERR_FD

#define COAP_ERR_FD   stderr

Definition at line 18 of file debug.h.

§ coap_log

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

Definition at line 58 of file debug.h.

§ debug

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

Definition at line 66 of file debug.h.

§ info

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

Definition at line 64 of file debug.h.

§ warn

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

Definition at line 65 of file debug.h.

Enumeration Type Documentation

§ coap_log_t

enum coap_log_t

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

Enumerator
LOG_EMERG 
LOG_ALERT 
LOG_CRIT 
LOG_ERR 
LOG_WARNING 
LOG_NOTICE 
LOG_INFO 
LOG_DEBUG 

Definition at line 26 of file debug.h.

Function Documentation

§ coap_get_log_level()

coap_log_t coap_get_log_level ( void  )

Returns the current log level.

Definition at line 60 of file debug.c.

Here is the caller graph for this function:

§ coap_log_impl()

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

Here is the call graph for this function:

§ coap_package_name()

const char* coap_package_name ( void  )

Returns a zero-terminated string with the name of this library.

Definition at line 51 of file debug.c.

§ coap_package_version()

const char* coap_package_version ( void  )

Returns a zero-terminated string with the library version.

Definition at line 55 of file debug.c.

§ coap_print_addr()

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

Definition at line 162 of file debug.c.

Here is the call graph for this function:
Here is the caller graph for this function:

§ coap_set_log_level()

void coap_set_log_level ( coap_log_t  level)

Sets the log level to the specified value.

Definition at line 65 of file debug.c.

§ coap_show_pdu()

void coap_show_pdu ( const coap_pdu_t )

Definition at line 375 of file debug.c.

Here is the call graph for this function:
Here is the caller graph for this function: