Private implementation of the logger_default adapter.
More...
#include "logger/adapters/logger_adapters_api.h"#include "logger_default/cr/logger_default_cr_api.h"#include "stream/borrowers/stream.h"#include "osal/time/osal_time.h"#include "osal/mem/osal_mem.h"#include "policy/lexleo_assert.h"#include "policy/lexleo_cstd_inttypes.h"#include "policy/lexleo_cstd_io.h"#include "internal/logger_default_handle.h"#include "internal/logger_default_utc_timestamp.h"
Go to the source code of this file.
Functions | |
| logger_default_cfg_t | logger_default_default_cfg (void) |
Return the default configuration for the logger_default adapter. | |
| logger_default_env_t | logger_default_default_env (stream_t *stream, const osal_time_ops_t *time_ops, const osal_mem_ops_t *adapter_mem, const logger_env_t *port_env) |
Build a default environment for the logger_default adapter. | |
| static logger_status_t | logger_default_write_timestamp (stream_t *stream, const osal_time_ops_t *time_ops) |
Write the logger_default timestamp prefix to the target stream. | |
| static logger_status_t | logger_default_log (void *backend, const char *message) |
Private log implementation for the logger_default backend. | |
| static void | logger_default_destroy (void *backend) |
Private destroy implementation for the logger_default backend. | |
| logger_status_t | logger_default_create_logger (logger_t **out, const logger_default_cfg_t *cfg, const logger_default_env_t *env) |
Create a logger instance backed by the logger_default adapter. | |
Variables | |
| static const logger_vtbl_t | DEFAULT_VTBL |
Private backend vtable for logger_default. | |
This file implements:
logger_default into the logger port,logger_default-backed logger_t. Definition in file logger_default.c.
| logger_status_t logger_default_create_logger | ( | logger_t ** | out, |
| const logger_default_cfg_t * | cfg, | ||
| const logger_default_env_t * | env | ||
| ) |
This function allocates the private logger_default backend, initializes it from the injected configuration and environment, and then wires it into the public logger port through logger_create().
| [out] | out | Receives the created logger handle. Must not be NULL. |
| [in] | cfg | Adapter configuration. Must not be NULL. |
| [in] | env | Adapter environment. Must not be NULL. |
| LOGGER_STATUS_OK | Logger successfully created. |
| LOGGER_STATUS_INVALID | One or more public arguments are invalid. |
| LOGGER_STATUS_OOM | Adapter-backend allocation failed. |
Definition at line 314 of file logger_default.c.
| logger_default_cfg_t logger_default_default_cfg | ( | void | ) |
Return a default configuration for the logger_default adapter.
This helper establishes the default runtime behavior of the adapter.
logger_default_cfg_t. Definition at line 43 of file logger_default.c.
| logger_default_env_t logger_default_default_env | ( | stream_t * | stream, |
| const osal_time_ops_t * | time_ops, | ||
| const osal_mem_ops_t * | adapter_mem, | ||
| const logger_env_t * | port_env | ||
| ) |
This helper packages borrowed runtime dependencies into a logger_default_env_t.
| [in] | stream | Borrowed target stream used by the adapter. |
| [in] | time_ops | Borrowed time operations used for timestamp generation. |
| [in] | adapter_mem | Borrowed memory operations used for adapter-backend allocation. |
| [in] | port_env | Borrowed logger port environment. |
logger_default_env_t aggregating the provided dependencies. Definition at line 70 of file logger_default.c.
|
static |
This function releases the private backend object using the injected adapter-memory operations table.
| [in] | backend | Private logger_default backend handle. May be NULL. |
Definition at line 265 of file logger_default.c.
|
static |
This function writes:
| [in] | backend | Private logger_default backend handle. Must not be NULL. |
| [in] | message | Message to log. |
| LOGGER_STATUS_OK | Message successfully written. |
| LOGGER_STATUS_INVALID | message == NULL. |
| LOGGER_STATUS_IO_ERROR | A required stream write failed or was partial. |
Definition at line 209 of file logger_default.c.
|
static |
This helper obtains the current epoch time from the injected time service, converts it to a decomposed UTC+0 timestamp, formats it as text, and writes the resulting prefix to stream.
If the injected time service fails, this helper writes the fallback prefix "[timestamp error] " instead.
| [in] | stream | Target stream receiving the timestamp prefix. Must not be NULL. |
| [in] | time_ops | Borrowed time operations used to obtain the current epoch time. Must not be NULL. |
| LOGGER_STATUS_OK | Timestamp prefix successfully written, or fallback timestamp-error prefix successfully written. |
| LOGGER_STATUS_IO_ERROR | A stream write failed or produced a partial write, or timestamp formatting failed. |
Definition at line 111 of file logger_default.c.
|
static |
Definition at line 280 of file logger_default.c.