LexLeo 0.0.0-dev+f8e5087-dirty
Technical documentation
Loading...
Searching...
No Matches
logger_default_cr_api.h File Reference

Composition Root API for wiring the logger_default adapter. More...

Include dependency graph for logger_default_cr_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

logger_default_cfg_t logger_default_default_cfg (void)
 Return a 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.
 
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.
 

Detailed Description

This header exposes the CR-facing entry points used to:

  • build default logger_default configuration and environment values,
  • create a logger instance backed by the logger_default adapter.

Definition in file logger_default_cr_api.h.

Function Documentation

◆ logger_default_create_logger()

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 and initializes a public logger_t whose backend writes emitted messages to the injected target stream.

Ownership:

  • On success, a newly allocated logger is returned in *out.
  • The caller becomes responsible for destroying it via logger_destroy().
  • On failure, *out is left unchanged.
Parameters
[out]outReceives the created logger handle. Must not be NULL.
[in]cfgAdapter configuration. Must not be NULL.
[in]envAdapter environment containing injected dependencies. Must not be NULL.
Return values
LOGGER_STATUS_OKLogger successfully created.
LOGGER_STATUS_INVALIDOne or more arguments are invalid.
LOGGER_STATUS_OOMMemory allocation failed.

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().

Parameters
[out]outReceives the created logger handle. Must not be NULL.
[in]cfgAdapter configuration. Must not be NULL.
[in]envAdapter environment. Must not be NULL.
Return values
LOGGER_STATUS_OKLogger successfully created.
LOGGER_STATUS_INVALIDOne or more public arguments are invalid.
LOGGER_STATUS_OOMAdapter-backend allocation failed.

Definition at line 314 of file logger_default.c.

◆ logger_default_default_cfg()

logger_default_cfg_t logger_default_default_cfg ( void  )

This helper provides a value-initialized baseline configuration that the Composition Root may override.

Returns
A well-formed logger_default_cfg_t.

Return a default configuration for the logger_default adapter.

This helper establishes the default runtime behavior of the adapter.

Returns
A well-formed logger_default_cfg_t.

Definition at line 43 of file logger_default.c.

◆ logger_default_default_env()

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 dependencies into a value-initialized logger_default_env_t.

The returned environment does not take ownership of any pointer passed as argument.

Parameters
[in]streamBorrowed target stream used by the adapter.
[in]time_opsBorrowed time operations used for timestamp generation.
[in]adapter_memBorrowed memory operations used for adapter-backend allocation.
[in]port_envBorrowed logger port environment.
Returns
A well-formed logger_default_env_t aggregating the provided dependencies.

This helper packages borrowed runtime dependencies into a logger_default_env_t.

Parameters
[in]streamBorrowed target stream used by the adapter.
[in]time_opsBorrowed time operations used for timestamp generation.
[in]adapter_memBorrowed memory operations used for adapter-backend allocation.
[in]port_envBorrowed logger port environment.
Returns
A well-formed logger_default_env_t aggregating the provided dependencies.

Definition at line 70 of file logger_default.c.