Veritable Lasagna
An Allocator & Data Structure Library for C.
Loading...
Searching...
No Matches
vl_log_sink_vtbl Struct Reference

Virtual function table for a log sink. More...

#include <vl_log.h>

+ Collaboration diagram for vl_log_sink_vtbl:

Data Fields

void(* write )(void *sink_data, const char *msg, vl_memsize_t len)
 Write a message to the sink.
 
void(* flush )(void *sink_data)
 Flush any buffered data held by the sink.
 
void(* destroy )(void *sink_data)
 Destroy sink state and release owned resources.
 

Detailed Description

Virtual function table for a log sink.

Each sink implementation supplies callbacks that allow a logger to:

  • write a message
  • flush buffered output
  • destroy sink-owned resources

The sink_data pointer passed to these functions is the same pointer stored in the corresponding vl_log_sink.

Warning
Sink callbacks should not recursively log back into the same logger, as that may cause deadlock, reentrancy issues, or unbounded recursion.

Field Documentation

◆ destroy

void(* vl_log_sink_vtbl::destroy) (void *sink_data)

Destroy sink state and release owned resources.

Parameters
sink_dataImplementation-specific sink state.

This is called by the logger when the sink is being torn down.

◆ flush

void(* vl_log_sink_vtbl::flush) (void *sink_data)

Flush any buffered data held by the sink.

Parameters
sink_dataImplementation-specific sink state.

◆ write

void(* vl_log_sink_vtbl::write) (void *sink_data, const char *msg, vl_memsize_t len)

Write a message to the sink.

Parameters
sink_dataImplementation-specific sink state.
msgPointer to message bytes.
lenNumber of bytes to write from msg.

The documentation for this struct was generated from the following file: