Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
rte_log_fields_t Struct Reference

Bounded builder for rte_log_write_event()'s extra_fields (or info) argument: accumulates space-separated key=value pairs, each typed at the call site, so a caller adding a couple of variable values does not hand-roll a rte_string_concat()/rte_string_append_u32() chain every time (MISRA C:2012 Rule 17.1 rules out a printf-style variadic here). More...

#include <rte_log.h>

Collaboration diagram for rte_log_fields_t:
[legend]

Data Fields

rte_string_t str
char storage [RTE_LOG_EVENT_LINE_MAX_LEN]

Detailed Description

Bounded builder for rte_log_write_event()'s extra_fields (or info) argument: accumulates space-separated key=value pairs, each typed at the call site, so a caller adding a couple of variable values does not hand-roll a rte_string_concat()/rte_string_append_u32() chain every time (MISRA C:2012 Rule 17.1 rules out a printf-style variadic here).

All storage is inside the struct - no allocation. Over-long content is truncated, never rejected, matching rte_log_write_event()'s own REQ-OAL-LOG-001 posture. Typical use:

rte_log_fields_add_u32(&f, "route", route_id);
rte_log_fields_add_i32(&f, "d_lrbg", d_lrbg);
rte_log_fields_add_str(&f, "result", "OK");
"A/WEST", "IL", "ROUTE", "route connected", &f);
rte_log_fields_t * rte_log_fields_add_str(rte_log_fields_t *fields, const char *key, const char *value)
Appends one key=value pair (preceded by a single separating space only when the builder is already no...
Definition rte_log.c:285
void rte_log_fields_reset(rte_log_fields_t *fields)
(Re)initialises a builder to empty. MUST be called before the first rte_log_fields_add_*(); safe to c...
Definition rte_log.c:254
void rte_log_write_event_fields(rte_log_level_t level, const char *site, uint32_t cycle, const char *source, const char *destination, const char *type, const char *info, rte_log_fields_t *fields)
rte_log_write_event() with a builder passed directly as the extra fields - no rte_log_fields_c_str() ...
Definition rte_log.c:366
@ RTE_LOG_LEVEL_INFO
Definition rte_log.h:36
Bounded builder for rte_log_write_event()'s extra_fields (or info) argument: accumulates space-separa...
Definition rte_log.h:232

Definition at line 231 of file rte_log.h.

Field Documentation

◆ str

rte_string_t rte_log_fields_t::str

Bound to storage by rte_log_fields_reset().

Definition at line 233 of file rte_log.h.

◆ storage

char rte_log_fields_t::storage[RTE_LOG_EVENT_LINE_MAX_LEN]

Backing bytes - do not touch directly.

Definition at line 234 of file rte_log.h.


The documentation for this struct was generated from the following file: