logging: Add network backend

Allow logging subsystem to send the logging messages to outside
system. This backend implements RFC 5424 (syslog protocol) and
RFC 5426 (syslog over UDP).

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2018-10-12 17:31:57 +03:00 committed by Anas Nashif
commit 44a9bb6abe
5 changed files with 408 additions and 11 deletions

View file

@ -39,6 +39,10 @@ extern "C" {
/** @brief Flag forcing a single LF character for line breaks. */
#define LOG_OUTPUT_FLAG_CRLF_LFONLY BIT(5)
/** @brief Flag forcing syslog format specified in RFC 5424
*/
#define LOG_OUTPUT_FLAG_FORMAT_SYSLOG BIT(6)
/**
* @brief Prototype of the function processing output data.
*
@ -54,6 +58,7 @@ typedef int (*log_output_func_t)(u8_t *buf, size_t size, void *ctx);
struct log_output_control_block {
size_t offset;
void *ctx;
const char *hostname;
};
/** @brief Log_output instance structure. */
@ -110,6 +115,16 @@ static inline void log_output_ctx_set(const struct log_output *log_output,
log_output->control_block->ctx = ctx;
}
/** @brief Function for setting hostname of this device
*
* @param log_output Pointer to the log output instance.
* @param hostname Hostname of this device
*/
static inline void log_output_hostname_set(const struct log_output *log_output,
const char *hostname)
{
log_output->control_block->hostname = hostname;
}
/** @brief Set timestamp frequency.
*