Private implementation of the logger port.
More...
Go to the source code of this file.
◆ logger_create()
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] | out | Receives the created logger handle. Must not be NULL. |
| [in] | vtbl | Backend dispatch table. Must not be NULL and must provide non-NULL operations. |
| [in] | backend | Adapter-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] | env | Logger 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.
◆ logger_default_env()
- Parameters
-
| [in] | mem_ops | Memory operations to expose through the returned environment. |
- Returns
- A
logger_env_t such that ret.mem == mem_ops.
- Note
- This helper does not allocate and performs no validation. It only packages the provided dependency into a public
logger_env_t.
Definition at line 22 of file logger.c.
◆ logger_destroy()
- Parameters
-
| [in,out] | l | Address of the logger handle to destroy. |
If l == NULL or *l == NULL, this function does nothing. Otherwise, it releases the logger object and sets *l to NULL.
Definition at line 57 of file logger.c.
◆ logger_log()
- Parameters
-
| [in] | l | Logger handle used to emit the message. |
| [in] | message | Null-terminated message to log. |
- Returns
- Operation status.
This function exposes the borrower-facing logging operation of the logger port.
Definition at line 77 of file logger.c.