19#ifndef SAFEAPI_OS_LOG_H
20#define SAFEAPI_OS_LOG_H
33typedef enum sapi_log_level_e
122#define SAPI_LOG_EVENT_LINE_MAX_LEN 256U
204 const char *destination,
207 const char *extra_fields);
231typedef struct sapi_log_fields_s
267 uint32_t value, uint8_t min_digits);
295 const char *destination,
void sapi_log_write_event(sapi_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...
const char * sapi_log_level_to_string(sapi_log_level_t level)
Renders a sapi_log_level_t as a fixed, human-readable tag - "DEBUG"/"INFO"/"WARNING"/"ERROR" - used a...
sapi_log_level_t
Log message severity, passed to sapi_log_write().
const char * sapi_log_fields_c_str(sapi_log_fields_t *fields)
NUL-terminated view of the accumulated pairs.
sapi_log_level_t sapi_log_get_level(void)
Returns the current minimum severity (see sapi_log_set_level()). REQ-OAL-LOG-015.
void sapi_log_write_event_fields(sapi_log_level_t level, const char *site, uint32_t cycle, const char *source, const char *destination, const char *type, const char *info, sapi_log_fields_t *fields)
sapi_log_write_event() with a builder passed directly as the extra fields - no sapi_log_fields_c_str(...
void sapi_log_set_level(sapi_log_level_t min_level)
Sets the minimum severity that sapi_log_write() and sapi_log_write_event() forward to the backend - a...
sapi_status_t sapi_log_level_from_string(const char *name, sapi_log_level_t *out_level)
Parses one of the canonical level spellings ("DEBUG", "INFO", "WARNING", "ERROR" - exactly as sapi_lo...
sapi_status_t sapi_log_init(void)
Initializes the logging backend. Safe to call once at startup.
void sapi_log_fields_reset(sapi_log_fields_t *fields)
(Re)initialises a builder to empty. MUST be called before the first sapi_log_fields_add_*(); safe to ...
void sapi_log_write(sapi_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...
#define SAPI_LOG_EVENT_LINE_MAX_LEN
Max length, in bytes and not counting the NUL terminator, of one sapi_log_write_event() line - fields...
sapi_log_fields_t * sapi_log_fields_add_str(sapi_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...
sapi_status_t
Common result/status codes.
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
Bounded, checked string manipulation (ADR-006). Replaces strcpy/strcat/sprintf/atoi/strtok-style unbo...
Common fixed-width types and the caller-owned-storage handle pattern used by every OAL service (see A...
Bounded builder for sapi_log_write_event()'s extra_fields (or info) argument: accumulates space-separ...
char storage[SAPI_LOG_EVENT_LINE_MAX_LEN]
Bounded string: buf.length is the string length, not counting a NUL.