libcoap
4.3.0
|
API functions for logging support. More...
Macros | |
#define | COAP_DEBUG_FD stdout |
Used for output for LOG_DEBUG to LOG_ERR . More... | |
#define | COAP_ERR_FD stderr |
Used for output for LOG_CRIT to LOG_EMERG . More... | |
#define | coap_log(level, ...) |
Logging function. More... | |
Typedefs | |
typedef void(* | coap_log_handler_t) (coap_log_t level, const char *message) |
Logging callback handler definition. More... | |
Enumerations | |
enum | coap_log_t { LOG_EMERG =0 , LOG_ALERT , LOG_CRIT , LOG_ERR , LOG_WARNING , LOG_NOTICE , LOG_INFO , LOG_DEBUG , COAP_LOG_CIPHERS =LOG_DEBUG+2 } |
Pre-defined log levels akin to what is used in syslog with LOG_CIPHERS added. More... | |
Functions | |
coap_log_t | coap_get_log_level (void) |
Get the current logging level. More... | |
void | coap_set_log_level (coap_log_t level) |
Sets the log level to the specified value. More... | |
void | coap_set_log_handler (coap_log_handler_t handler) |
Add a custom log callback handler. More... | |
const char * | coap_package_name (void) |
Get the library package name. More... | |
const char * | coap_package_version (void) |
Get the library package 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_ERR ). More... | |
void | coap_set_show_pdu_output (int use_fprintf) |
Defines the output mode for the coap_show_pdu() function. More... | |
void | coap_show_pdu (coap_log_t level, const coap_pdu_t *pdu) |
Display the contents of the specified pdu . More... | |
void | coap_show_tls_version (coap_log_t level) |
Display the current (D)TLS library linked with and built for version. More... | |
char * | coap_string_tls_version (char *buffer, size_t bufsize) |
Build a string containing the current (D)TLS library linked with and built for version. More... | |
char * | coap_string_tls_support (char *buffer, size_t bufsize) |
Build a string containing the current (D)TLS library support. More... | |
size_t | coap_print_addr (const coap_address_t *address, unsigned char *buffer, size_t size) |
Print the address into the defined buffer. More... | |
void | coap_dtls_set_log_level (int level) |
Sets the (D)TLS logging level to the specified level . More... | |
int | coap_dtls_get_log_level (void) |
Get the current (D)TLS logging. More... | |
const char * | coap_session_str (const coap_session_t *session) |
Get session description. More... | |
const char * | coap_endpoint_str (const coap_endpoint_t *endpoint) |
Get endpoint description. More... | |
API functions for logging support.
#define COAP_DEBUG_FD stdout |
Used for output for LOG_DEBUG
to LOG_ERR
.
Definition at line 25 of file coap_debug.h.
#define COAP_ERR_FD stderr |
Used for output for LOG_CRIT
to LOG_EMERG
.
Definition at line 32 of file coap_debug.h.
#define coap_log | ( | level, | |
... | |||
) |
Logging function.
Writes the given text to COAP_ERR_FD
(for level
<= LOG_CRIT
) or COAP_DEBUG_FD
(for level
>= LOG_ERR
). The text is output only when level
is below or equal to the log level that set by coap_set_log_level().
level | One of the LOG_* values. |
Definition at line 152 of file coap_debug.h.
typedef void(* coap_log_handler_t) (coap_log_t level, const char *message) |
Logging callback handler definition.
level | One of the LOG_* values. |
message | Zero-terminated string message to log. |
Definition at line 103 of file coap_debug.h.
enum coap_log_t |
Pre-defined log levels akin to what is used in syslog with LOG_CIPHERS added.
Enumerator | |
---|---|
LOG_EMERG | Emergency. |
LOG_ALERT | Alert. |
LOG_CRIT | Critical. |
LOG_ERR | Error. |
LOG_WARNING | Warning. |
LOG_NOTICE | Notice. |
LOG_INFO | Information. |
LOG_DEBUG | Debug. |
COAP_LOG_CIPHERS | CipherInfo. |
Definition at line 51 of file coap_debug.h.
int coap_dtls_get_log_level | ( | void | ) |
Get the current (D)TLS logging.
Definition at line 92 of file coap_notls.c.
void coap_dtls_set_log_level | ( | int | level | ) |
Sets the (D)TLS logging level to the specified level
.
Note: coap_log_level() will influence output if at a specified level.
level | The logging level to use - LOG_* |
Definition at line 87 of file coap_notls.c.
const char* coap_endpoint_str | ( | const coap_endpoint_t * | endpoint | ) |
Get endpoint description.
endpoint | The CoAP endpoint. |
Definition at line 1419 of file coap_session.c.
coap_log_t coap_get_log_level | ( | void | ) |
Get the current logging level.
Definition at line 63 of file coap_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_ERR
).
The text is output only when level
is below or equal to the log level that set by coap_set_log_level().
Internal function.
level | One of the LOG_* values. & |
format | The format string to use. |
Definition at line 887 of file coap_debug.c.
const char* coap_package_name | ( | void | ) |
Get the library package name.
Definition at line 49 of file coap_debug.c.
const char* coap_package_version | ( | void | ) |
Get the library package version.
Definition at line 53 of file coap_debug.c.
size_t coap_print_addr | ( | const coap_address_t * | address, |
unsigned char * | buffer, | ||
size_t | size | ||
) |
Print the address into the defined buffer.
Internal Function.
address | The address to print. |
buffer | The buffer to print into. |
size | The size of the buffer to print into. |
Definition at line 173 of file coap_debug.c.
const char* coap_session_str | ( | const coap_session_t * | session | ) |
Get session description.
session | The CoAP session. |
Definition at line 1380 of file coap_session.c.
void coap_set_log_handler | ( | coap_log_handler_t | handler | ) |
Add a custom log callback handler.
handler | The logging handler to use or NULL to use default handler. |
Definition at line 882 of file coap_debug.c.
void coap_set_log_level | ( | coap_log_t | level | ) |
Sets the log level to the specified value.
level | One of the LOG_* values. |
Definition at line 68 of file coap_debug.c.
void coap_set_show_pdu_output | ( | int | use_fprintf | ) |
Defines the output mode for the coap_show_pdu() function.
use_fprintf | 1 if the output is to use fprintf() (the default) 0 if the output is to use coap_log(). |
Definition at line 58 of file coap_debug.c.
void coap_show_pdu | ( | coap_log_t | level, |
const coap_pdu_t * | pdu | ||
) |
Display the contents of the specified pdu
.
Note: The output method of coap_show_pdu() is dependent on the setting of coap_set_show_pdu_output().
level | The required minimum logging level. |
pdu | The PDU to decode. |
Definition at line 507 of file coap_debug.c.
void coap_show_tls_version | ( | coap_log_t | level | ) |
Display the current (D)TLS library linked with and built for version.
level | The required minimum logging level. |
Definition at line 746 of file coap_debug.c.
char* coap_string_tls_support | ( | char * | buffer, |
size_t | bufsize | ||
) |
Build a string containing the current (D)TLS library support.
buffer | The buffer to put the string into. |
bufsize | The size of the buffer to put the string into. |
Definition at line 845 of file coap_debug.c.
char* coap_string_tls_version | ( | char * | buffer, |
size_t | bufsize | ||
) |
Build a string containing the current (D)TLS library linked with and built for version.
buffer | The buffer to put the string into. |
bufsize | The size of the buffer to put the string into. |
Definition at line 753 of file coap_debug.c.