API functions for logging support.
More...
API functions for logging support.
◆ COAP_DEBUG_FD
| #define COAP_DEBUG_FD stdout |
Used for output for LOG_DEBUG to LOG_ERR.
Definition at line 23 of file debug.h.
◆ COAP_ERR_FD
| #define COAP_ERR_FD stderr |
Used for output for LOG_CRIT to LOG_EMERG.
Definition at line 30 of file debug.h.
◆ coap_log
| #define coap_log |
( |
|
level, |
|
|
|
... |
|
) |
| |
Value:do { \
coap_log_impl((level), __VA_ARGS__); \
} while(0)
coap_log_t coap_get_log_level(void)
Get the current logging 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().
- Parameters
-
| level | One of the LOG_* values. |
Definition at line 122 of file debug.h.
◆ coap_log_handler_t
| typedef void(* coap_log_handler_t) (coap_log_t level, const char *message) |
Logging call-back handler definition.
- Parameters
-
| level | One of the LOG_* values. |
| message | Zero-terminated string message to log. |
Definition at line 73 of file debug.h.
◆ coap_log_t
Pre-defined log levels akin to what is used in syslog.
| 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.
|
Definition at line 41 of file debug.h.
◆ coap_dtls_get_log_level()
| int coap_dtls_get_log_level |
( |
void |
| ) |
|
Get the current (D)TLS logging.
- Returns
- The current log level (one of LOG_*).
Definition at line 81 of file coap_notls.c.
◆ coap_dtls_set_log_level()
| 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.
- Parameters
-
| level | The logging level to use - LOG_* |
Definition at line 76 of file coap_notls.c.
◆ coap_endpoint_str()
Get endpoint description.
- Parameters
-
| endpoint | The CoAP endpoint. |
- Returns
- description string.
Definition at line 980 of file coap_session.c.
◆ coap_get_log_level()
Get the current logging level.
- Returns
- One of the LOG_* values.
Definition at line 71 of file debug.c.
◆ 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_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.
- Parameters
-
| level | One of the LOG_* values. & |
| format | The format string to use. |
Definition at line 746 of file debug.c.
◆ coap_package_name()
| const char* coap_package_name |
( |
void |
| ) |
|
Get the library package name.
- Returns
- Zero-terminated string with the name of this library.
Definition at line 57 of file debug.c.
◆ coap_package_version()
| const char* coap_package_version |
( |
void |
| ) |
|
Get the library package version.
- Returns
- Zero-terminated string with the library version.
Definition at line 61 of file debug.c.
◆ coap_print_addr()
| size_t coap_print_addr |
( |
const struct coap_address_t * |
address, |
|
|
unsigned char * |
buffer, |
|
|
size_t |
size |
|
) |
| |
Print the address into the defined buffer.
Internal Function.
- Parameters
-
| address | The address to print. |
| buffer | The buffer to print into. |
| size | The size of the buffer to print into. |
- Returns
- The amount written into the buffer.
Definition at line 171 of file debug.c.
◆ coap_session_str()
Get session description.
- Parameters
-
- Returns
- description string.
Definition at line 943 of file coap_session.c.
◆ coap_set_log_handler()
Add a custom log callback handler.
- Parameters
-
| handler | The logging handler to use or NULL to use default handler. |
Definition at line 741 of file debug.c.
◆ coap_set_log_level()
Sets the log level to the specified value.
- Parameters
-
| level | One of the LOG_* values. |
Definition at line 76 of file debug.c.
◆ coap_set_show_pdu_output()
| void coap_set_show_pdu_output |
( |
int |
use_fprintf | ) |
|
Defines the output mode for the coap_show_pdu() function.
- Parameters
-
| use_fprintf | 1 if the output is to use fprintf() (the default) 0 if the output is to use coap_log(). |
Definition at line 66 of file debug.c.
◆ coap_show_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().
- Parameters
-
| level | The required minimum logging level. |
| pdu | The PDU to decode. |
Definition at line 461 of file debug.c.
◆ coap_show_tls_version()
Display the current (D)TLS library linked with and built for version.
- Parameters
-
| level | The required minimum logging level. |
Definition at line 651 of file debug.c.
◆ coap_string_tls_version()
| 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.
- Parameters
-
| buffer | The buffer to put the string into. |
| bufsize | The size of the buffer to put the string into. |
- Returns
- A pointer to the provided buffer.
Definition at line 658 of file debug.c.