28 rd_status_t non_fatal_mask,
const char * file,
int line)
36 bool fatal = ~non_fatal_mask & error;
38 const char * filename = strrchr (file,
'/');
41 if (NULL == filename) { filename = strrchr (file,
'\\'); }
44 if (NULL == filename) { filename = file; }
51 index += snprintf (message,
sizeof (message),
"%s:%d FATAL: ", filename, line);
53 (
sizeof (message) - index));
54 snprintf ( (message + index), (
sizeof (message) - index),
"\r\n");
62 index += snprintf (message,
sizeof (message),
"%s:%d WARNING: ", filename, line);
64 (
sizeof (message) - index));
65 snprintf ( (message + index), (
sizeof (message) - index),
"\r\n");
72 m_cb (error, fatal, filename, line);
void rd_error_cb_set(rd_error_cb cb)
Configure application callback for errors.
uint32_t rd_status_t
bitfield for representing errors
void(* rd_error_cb)(const rd_status_t error, const bool fatal, const char *file, const int line)
void rd_error_check(rd_status_t error, rd_status_t non_fatal_mask, const char *file, int line)
Check given error code and compare it to non-fatal errors.
#define RD_SUCCESS
Internal Error.
rd_status_t rd_errors_clear()
void ri_log(const ri_log_severity_t severity, const char *const message)
Queues messages into log.
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....
rd_status_t ri_log_flush(void)
Blocks until remaining log messages are sent out.
Header to enable and disable module compilation.
#define RD_LOG_BUFFER_SIZE
Maximum length of one log message.
Ruuvi error codes and error check function.