84 if (osadapter == NULL)
93 return lifecycle_status;
129 if ((name != NULL) && (out_level != NULL))
192 const char *destination,
195 const char *extra_fields)
202 const char *ts_cstr = NULL;
203 const char *line_cstr = NULL;
237 if ((extra_fields != NULL) && (extra_fields[0] !=
'\0'))
251 s_osadapter->write(level, source, (line_cstr != NULL) ? line_cstr :
"");
271 bool ok = (fields != NULL) && (key != NULL);
331 uint32_t value, uint8_t min_digits)
352 const char *out =
"";
356 const char *tmp = NULL;
370 const char *destination,
394 char num_storage[16];
396 const char *num_cstr = NULL;
rte_status_t rte_lifecycle_check_setup_allowed(void)
Convenience check for a setup-only constructor: call this as one of the first checks in any function ...
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...
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...
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/receive...
rte_log_level_t rte_log_get_level(void)
Returns the current minimum severity (see rte_log_set_level()). REQ-OAL-LOG-015.
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...
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...
const char * rte_log_fields_c_str(rte_log_fields_t *fields)
NUL-terminated view of the accumulated pairs.
rte_log_level_t
Log message severity, passed to rte_log_write().
#define RTE_LOG_EVENT_LINE_MAX_LEN
Max length, in bytes and not counting the NUL terminator, of one rte_log_write_event() line - fields ...
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...
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 dro...
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() ...
rte_status_t
Common result/status codes.
@ RTE_STATUS_INVALID_PARAM
rte_status_t rte_string_append_i64(rte_string_t *dest, int64_t value)
Bounded base-10 append of an int64_t; a leading '-' is emitted for negative values....
rte_status_t rte_string_append_u32(rte_string_t *dest, uint32_t value)
Bounded base-10 append of a uint32_t to dest's existing content (unlike rte_string_from_u32(),...
size_t rte_string_length(const rte_string_t *str)
Returns a string's current length (not counting a NUL terminator).
rte_status_t rte_string_concat(rte_string_t *dest, const char *src)
Bounded strcat equivalent. Never calls strlen(src) - scans for a NUL only up to dest's remaining capa...
rte_status_t rte_string_c_str(rte_string_t *str, const char **out_cstr)
Ensures a NUL terminator is present within capacity (without incrementing length) and returns a point...
rte_status_t rte_string_append_i32(rte_string_t *dest, int32_t value)
Bounded base-10 append of an int32_t; a leading '-' is emitted for negative values....
rte_status_t rte_string_append_hex_u32(rte_string_t *dest, uint32_t value, uint8_t min_digits)
Bounded append of a uint32_t formatted as lowercase hexadecimal (no "0x" prefix - the caller prepends...
rte_status_t rte_string_append_u64(rte_string_t *dest, uint64_t value)
Bounded base-10 append of a uint64_t. See rte_string_append_u32().
rte_status_t rte_string_init(rte_string_t *str, char *storage, size_t capacity)
Binds a string to caller-owned storage. Initial length is 0 (empty string).
rte_status_t rte_string_from_u64(rte_string_t *dest, uint64_t value)
Bounded base-10 itoa equivalent for uint64_t. Replaces dest's content.
rte_status_t rte_string_from_u32(rte_string_t *dest, uint32_t value)
Bounded base-10 itoa equivalent for uint32_t. Replaces dest's content.
rte_status_t rte_timer_now(rte_timestamp_ms_t *out_now_ms)
Returns the current monotonic time base used by all timers.
uint64_t rte_timestamp_ms_t
static const rte_osadapter_clocksync_t * s_osadapter
Process-wide application setup-phase lock (ADR-026).
static rte_log_level_t s_min_level
Minimum severity forwarded to the OSAdapter (rte_log_set_level()). RTE_LOG_LEVEL_DEBUG = nothing filt...
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()....
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) - t...
static const rte_log_level_name_t s_level_names[]
The four canonical spellings, kept in sync with rte_log_level_to_string().
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)....
OS Abstraction Layer - Logging/diagnostics service.
OSAdapter interface for logging and diagnostics.
rte_status_t rte_osadapter_log_register(const rte_osadapter_log_t *adapter)
Registers the OSAdapter log implementation.
Bounded, checked string manipulation (ADR-006). Replaces strcpy/strcat/sprintf/atoi/strtok-style unbo...
OS Abstraction Layer - Timer service.
Bounded builder for rte_log_write_event()'s extra_fields (or info) argument: accumulates space-separa...
char storage[RTE_LOG_EVENT_LINE_MAX_LEN]
One canonical level spelling <-> value pair for rte_log_level_from_string().
OSAdapter logging operations vtable.
Bounded string: buf.length is the string length, not counting a NUL.