pdcomm_logging_status
Function
Copies the current logging status as a JSON object.
PdcommStatus pdcomm_logging_status(uint8_t *output, size_t capacity, size_t *required)The object has schema_version 1 and reports the active configuration (enabled, level, level_name, sink, max_bytes, files, forensics), the queue and record limits, and the counters written, dropped, write_errors, and configuration_errors. The bytes are UTF-8 JSON without a terminating NUL.
Parameters
| Name | Description |
|---|---|
output | Destination for the JSON bytes. May be NULL only when capacity is 0. |
capacity | Size of output in bytes. |
required | Receives the length of the JSON text. Must not be NULL. |
Returns
#PDCOMM_OK when the text was copied; #PDCOMM_BUFFER_TOO_SMALL when capacity is smaller than *required (output untouched); #PDCOMM_INVALID_ARGUMENT when required is NULL, or output is NULL with a nonzero capacity (*required is not written); #PDCOMM_INTERNAL_ERROR when serialization failed or a panic was contained.
Notes
- The counters change while logging is active, so the length can grow between a size query and the copy. Allocate some headroom and repeat the call when it returns #PDCOMM_BUFFER_TOO_SMALL.
- Thread safety: may be called from any thread.