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

Adapter-side API for constructing and binding logger_t objects. More...

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

Go to the source code of this file.

Data Structures

struct  logger_vtbl_t
 Adapter dispatch table bound to a logger_t instance. More...
 

Typedefs

typedef struct logger_vtbl_t logger_vtbl_t
 

Functions

logger_status_t logger_create (logger_t **out, const logger_vtbl_t *vtbl, void *backend, const logger_env_t *env)
 Create a generic logger handle from adapter-provided backend bindings.
 

Detailed Description

This header exposes the adapter-facing contract used to bind a backend implementation to the generic logger_t port.

It defines:

Typical usage:

  • an adapter defines backend operations matching this contract,
  • fills a logger_vtbl_t,
  • allocates or prepares its backend state,
  • calls logger_create() to build the public logger handle.

Definition in file logger_adapters_api.h.

Typedef Documentation

◆ logger_vtbl_t

typedef struct logger_vtbl_t logger_vtbl_t

Function Documentation

◆ logger_create()

logger_status_t logger_create ( logger_t **  out,
const logger_vtbl_t vtbl,
void *  backend,
const logger_env_t env 
)

This function is intended to be called by logger adapters to construct a public logger_t from:

  • a dispatch table describing backend operations,
  • an adapter-owned backend instance,
  • an injected environment carrying runtime dependencies.

The produced logger handle takes ownership of neither the vtable nor the environment object itself; it only stores the required runtime references. The backend lifetime and destruction semantics are governed by the adapter contract, notably through vtbl->destroy.

Parameters
[out]outReceives the created logger handle. Must not be NULL.
[in]vtblBackend dispatch table. Must not be NULL and must provide non-NULL operations.
[in]backendAdapter-owned backend instance to bind to the logger. May be NULL only if the resulting semantics are explicitly supported by the caller, though normal adapters are expected to provide a valid backend.
[in]envLogger environment carrying injected runtime dependencies. Must not be NULL.
Returns
  • LOGGER_STATUS_OK on success
  • LOGGER_STATUS_INVALID if arguments are invalid
  • LOGGER_STATUS_OOM on allocation failure
Postcondition
On success, *out contains a valid logger handle that must later be destroyed via logger_destroy().

Definition at line 27 of file logger.c.