wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
debug.h File Reference

Minimal libc-free tracing for freestanding binaries: write to stderr and format a decimal, with a compile-out gate. More...

Go to the source code of this file.

Data Structures

struct  wired_fmt_u64_in
 The value to format and its minimum zero-padded width. More...

Macros

#define WIRED_LOG(s)
 Trace macro: expands to a timestamped log under -DWIRED_DEBUG, nothing else.

Functions

void wired_fmt_u64 (char *out, usz *at, const wired_fmt_u64_in *in)
 Write in->v as decimal into out at *at, left-padded with '0' to in->width.
void wired_log_str (const char *s)
 Write a NUL-terminated string to stderr (fd 2).
void wired_log_ts (const char *s)
 Write a CLOCK_REALTIME "sec.nsec " timestamp then s to stderr.

Detailed Description

Minimal libc-free tracing for freestanding binaries: write to stderr and format a decimal, with a compile-out gate.

The SDK is otherwise silent, so an example/binary that wants trace output uses these rather than pulling in a print library.

Macro Definition Documentation

◆ WIRED_LOG

#define WIRED_LOG ( s)
Value:
((void)0)

Trace macro: expands to a timestamped log under -DWIRED_DEBUG, nothing else.

Function Documentation

◆ wired_fmt_u64()

void wired_fmt_u64 ( char * out,
usz * at,
const wired_fmt_u64_in * in )

Write in->v as decimal into out at *at, left-padded with '0' to in->width.

Parameters
outdestination character buffer (caller sizes it; a u64 needs at most 20 digits)
atwrite cursor into out; advanced past the emitted digits
invalue and minimum zero-padded width

◆ wired_log_str()

void wired_log_str ( const char * s)

Write a NUL-terminated string to stderr (fd 2).

Parameters
sNUL-terminated string to write

◆ wired_log_ts()

void wired_log_ts ( const char * s)

Write a CLOCK_REALTIME "sec.nsec " timestamp then s to stderr.

Parameters
sNUL-terminated string written after the timestamp