|
| static void | rte_log_append_event_field (rte_string_t *line, const char *key, const char *value) |
| | Appends " Key=Value" to *line (a leading space, then key, "=", then value or "" if value is NULL) - the Key=Value pair convention rte_log_write_event() uses for every field. Best-effort: a RTE_STATUS_RESOURCE_EXHAUSTED from any concat is silently accepted (line is left truncated at whatever fit) - REQ-OAL-LOG-001, this must never fail the caller's control flow, so there is nothing to report here.
|
| static void | rte_log_append_event_field_u32 (rte_string_t *line, const char *key, uint32_t value) |
| | Formats value in base 10 and appends it as "Key=value" via rte_log_append_event_field(). Uses a small local rte_string_t/buffer, independent of *line's own storage.
|
| rte_status_t | rte_osadapter_log_register (const rte_osadapter_log_t *osadapter) |
| | Registers the OSAdapter log implementation.
|
| rte_status_t | rte_log_init (void) |
| | Initializes the logging OSAdapter. Safe to call once at startup.
|
| void | rte_log_write (rte_log_level_t level, const char *tag, const char *message) |
| | Emits one log message. Non-blocking; never fails the caller's control flow even if the message is dropped.
|
| rte_status_t | rte_log_level_from_string (const char *name, rte_log_level_t *out_level) |
| | Parses one of the canonical level spellings ("DEBUG", "INFO", "WARNING", "ERROR" - exactly as rte_log_level_to_string() renders them, case-sensitive) into a rte_log_level_t.
|
| void | rte_log_set_level (rte_log_level_t min_level) |
| | Sets the minimum severity that rte_log_write() and rte_log_write_event() forward to the OSAdapter - a call whose level is below min_level is dropped before dispatch (and before any formatting work). Default is RTE_LOG_LEVEL_DEBUG: nothing is filtered until this is called.
|
| rte_log_level_t | rte_log_get_level (void) |
| | Returns the current minimum severity (see rte_log_set_level()). REQ-OAL-LOG-015.
|
| const char * | rte_log_level_to_string (rte_log_level_t level) |
| | Renders a rte_log_level_t as a fixed, human-readable tag - "DEBUG"/"INFO"/"WARNING"/"ERROR" - used as the LEVEL field of rte_log_write_event()'s structured line and available to any OSAdapter/integrator wanting the same canonical spelling.
|
| void | rte_log_write_event (rte_log_level_t level, const char *site, uint32_t cycle, const char *source, const char *destination, const char *type, const char *info, const char *extra_fields) |
| | Emits one structured inter-channel event/message-trail log line - for a message actually sent/received/decided between channels or nodes (e.g. an AB_SAMPLE frame, an M136 report, a checkpoint REQUEST/REPLY, a cross-compare AGREE/DISAGREE) - distinct from rte_log_write()'s free-text diagnostic logging, which remains the right call for an event with no natural cycle/source/destination (e.g. an NVM write failure).
|
| 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 call again to reuse the same builder for another line.
|
| static bool | rte_log_fields_begin_pair (rte_log_fields_t *fields, const char *key) |
| | Appends the "[ ]key=" prefix of one pair (leading space only if the builder already holds something). Best-effort; a truncated concat is silently accepted (REQ-OAL-LOG-001).
|
| 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 non-empty).
|
| rte_log_fields_t * | rte_log_fields_add_u32 (rte_log_fields_t *fields, const char *key, uint32_t value) |
| rte_log_fields_t * | rte_log_fields_add_i32 (rte_log_fields_t *fields, const char *key, int32_t value) |
| rte_log_fields_t * | rte_log_fields_add_u64 (rte_log_fields_t *fields, const char *key, uint64_t value) |
| rte_log_fields_t * | rte_log_fields_add_i64 (rte_log_fields_t *fields, const char *key, int64_t value) |
| rte_log_fields_t * | rte_log_fields_add_hex_u32 (rte_log_fields_t *fields, const char *key, uint32_t value, uint8_t min_digits) |
| rte_log_fields_t * | rte_log_fields_add_bool (rte_log_fields_t *fields, const char *key, bool value) |
| const char * | rte_log_fields_c_str (rte_log_fields_t *fields) |
| | NUL-terminated view of the accumulated pairs.
|
| 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() at the call site.
|
Logging service: dispatches to the OSAdapter registered via rte_osadapter_log_register() (ADR-005). No OSAdapter registered is not an error for this service - see rte_log.h.
rte_log_write_event()'s structured-line formatting (added alongside this file's own module) is what introduces this module's only two new dependencies, rte::string (bounded formatting - ADR-006) and rte::timer (TIMESTAMP field - rte_timer_now()); rte_log_write() itself and the OSAdapter dispatch below are unchanged and still have neither dependency.
Definition in file rte_log.c.