|
Oakfield API Documentation 1.0.0
Numerical core APIs
|
Lock-free asynchronous logging facilities for libsimcore runtime. More...


Go to the source code of this file.
Classes | |
| struct | SimAsyncLogRecord |
| Log entry materialized when records are drained from the ring buffer. More... | |
| struct | SimAsyncLogger |
| Lock-free ring buffer logger supporting multiple producers and a single consumer. More... | |
Macros | |
| #define | SIM_ASYNC_LOGGER_MESSAGE_MAX 255U |
Typedefs | |
| typedef enum SimLogLevel | SimLogLevel |
| Severity levels emitted by the asynchronous logger. | |
| typedef struct SimAsyncLogRecord | SimAsyncLogRecord |
| Log entry materialized when records are drained from the ring buffer. | |
| typedef struct SimAsyncLogger | SimAsyncLogger |
| Lock-free ring buffer logger supporting multiple producers and a single consumer. | |
Enumerations | |
| enum | SimLogLevel { SIM_LOG_LEVEL_TRACE = 0 , SIM_LOG_LEVEL_DEBUG , SIM_LOG_LEVEL_INFO , SIM_LOG_LEVEL_WARN , SIM_LOG_LEVEL_ERROR , SIM_LOG_LEVEL_FATAL } |
| Severity levels emitted by the asynchronous logger. More... | |
Functions | |
| SimResult | sim_async_logger_init (SimAsyncLogger *logger, size_t capacity) |
Initialize the asynchronous logger with a ring buffer of at least capacity elements. | |
| void | sim_async_logger_destroy (SimAsyncLogger *logger) |
| Destroy an asynchronous logger instance and release its storage. | |
| SimResult | sim_async_logger_log (SimAsyncLogger *logger, SimLogLevel level, const char *message) |
| Attempt to append a log record without blocking. | |
| bool | sim_async_logger_pop (SimAsyncLogger *logger, SimAsyncLogRecord *out_record) |
| Drain the next pending log record. | |
| void | sim_async_logger_clear (SimAsyncLogger *logger) |
| Clear all pending log entries without releasing internal storage. | |
Lock-free asynchronous logging facilities for libsimcore runtime.
| #define SIM_ASYNC_LOGGER_MESSAGE_MAX 255U |
Maximum length, in bytes, of a log message (excluding the null terminator).
| enum SimLogLevel |
Severity levels emitted by the asynchronous logger.
| void sim_async_logger_clear | ( | SimAsyncLogger * | logger | ) |
Clear all pending log entries without releasing internal storage.
| logger | Logger instance. |
| void sim_async_logger_destroy | ( | SimAsyncLogger * | logger | ) |
Destroy an asynchronous logger instance and release its storage.
| logger | Logger to destroy; may be NULL. |
| SimResult sim_async_logger_init | ( | SimAsyncLogger * | logger, |
| size_t | capacity | ||
| ) |
Initialize the asynchronous logger with a ring buffer of at least capacity elements.
| [out] | logger | Logger instance to initialize. |
| capacity | Requested capacity; rounded up to the next power of two (minimum 64). |
| SimResult sim_async_logger_log | ( | SimAsyncLogger * | logger, |
| SimLogLevel | level, | ||
| const char * | message | ||
| ) |
Attempt to append a log record without blocking.
When the ring buffer is full older messages are overwritten.
| logger | Logger instance. |
| level | Message severity. |
| message | Null-terminated string to append. |
| bool sim_async_logger_pop | ( | SimAsyncLogger * | logger, |
| SimAsyncLogRecord * | out_record | ||
| ) |
Drain the next pending log record.
| logger | Logger instance. | |
| [out] | out_record | Destination for the oldest pending record. |