|
ruuvi.drivers.c ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
|
Functions for printing out logs. More...
Files | |
| file | ruuvi_interface_log.h |
Enumerations | |
| enum | ri_log_severity_t { RI_LOG_LEVEL_NONE = 0 , RI_LOG_LEVEL_ERROR , RI_LOG_LEVEL_WARNING , RI_LOG_LEVEL_INFO , RI_LOG_LEVEL_DEBUG } |
| Enable implementation selected by application. More... | |
Functions | |
| rd_status_t | ri_log_init (const ri_log_severity_t min_severity) |
| Runs initialization code for the logging backend and sets the severity level. | |
| rd_status_t | ri_log_flush (void) |
| Blocks until remaining log messages are sent out. | |
| void | ri_log (const ri_log_severity_t severity, const char *const message) |
| Queues messages into log. | |
| void | ri_log_hex (const ri_log_severity_t severity, const uint8_t *const bytes, size_t byte_length) |
| Queues bytes to be logged out as a hex string. | |
| size_t | ri_error_to_string (rd_status_t error, char *error_string, size_t space_remaining) |
| Write text description of error message into given string pointer and null-terminate it. The string will be cut if it cannot fit into given space. | |
| void | ri_log_sensor_configuration (const ri_log_severity_t level, const rd_sensor_configuration_t *const configuration, const char *unit) |
Functions for printing out logs.
| enum ri_log_severity_t |
Enable implementation selected by application.
Severity levels of log messages. Lower numerical value means more severe.
| Enumerator | |
|---|---|
| RI_LOG_LEVEL_NONE | |
| RI_LOG_LEVEL_ERROR | |
| RI_LOG_LEVEL_WARNING | |
| RI_LOG_LEVEL_INFO | |
| RI_LOG_LEVEL_DEBUG | |
Definition at line 39 of file ruuvi_interface_log.h.
| size_t ri_error_to_string | ( | rd_status_t | error, |
| char * | error_string, | ||
| size_t | space_remaining | ||
| ) |
Write text description of error message into given string pointer and null-terminate it. The string will be cut if it cannot fit into given space.
| error | error code to convert to string |
| error_string | pointer to character array where error should be written |
| space_remaining | How many bytes there are remaining in the error string. |
Definition at line 379 of file ruuvi_interface_log.c.
| void ri_log | ( | const ri_log_severity_t | severity, |
| const char *const | message | ||
| ) |
Queues messages into log.
May block or may return as soon as data is in buffer being transferred out
| severity | severity of the log message |
| message | message string |
Definition at line 347 of file ruuvi_interface_log.c.
| rd_status_t ri_log_flush | ( | void | ) |
Blocks until remaining log messages are sent out.
Definition at line 333 of file ruuvi_interface_log.c.
| void ri_log_hex | ( | const ri_log_severity_t | severity, |
| const uint8_t *const | bytes, | ||
| size_t | byte_length | ||
| ) |
Queues bytes to be logged out as a hex string.
May block or may return as soon as data is in buffer being transferred out
| severity | severity of the log message |
| bytes | raw bytes to log |
| byte_length | length of bytes to log. |
Definition at line 363 of file ruuvi_interface_log.c.
| rd_status_t ri_log_init | ( | const ri_log_severity_t | min_severity | ) |
Runs initialization code for the logging backend and sets the severity level.
| min_severity | least severe log level that will be printed. |
| RD_SUCCESS | if log was init. |
| RD_ERROR_INVALID_STATE | if log had already been initialized. |
Definition at line 322 of file ruuvi_interface_log.c.
| void ri_log_sensor_configuration | ( | const ri_log_severity_t | level, |
| const rd_sensor_configuration_t *const | configuration, | ||
| const char * | unit | ||
| ) |
Log the given configuration parameters at given log level.
parameter level: Level of log. RI_LOG_ (ERROR, WARNING, INFO, DEBUG) parameter configuration: Configuration to print parameter unit: String representation to the unit of a scale
Definition at line 392 of file ruuvi_interface_log.c.