70 _In_opt_
void* userdata);
92 _In_opt_
void* userdata);
183void logFormatDate(_Inout_
string* out,
int dateFormat, uint32 flags, int64 timestamp);
void(* LogSerializeFunc)(string *out, const LogRecord *rec, void *userdata)
void logSerializerDestroy(LogSerializer **ser)
void logSerialize(string *out, LogSerializer *ser, const LogRecord *rec)
void logVarText(string *out, const stvar *v)
void logFormatChannel(string *out, LogChannel *chan, uint32 flags)
void logFormatLevel(string *out, int level, uint32 flags)
LogSerializer * logNdjsonSerializer(LogNdjsonConfig *config)
LogSerializer * logSerializerCreate(LogSerializeFunc serialize, LogSerializerClose close, void *userdata)
LOG_FLAGS
Formatting flags for text log output.
LogSerializer * logTextSerializer(LogTextConfig *config)
void(* LogSerializerClose)(void *userdata)
Releases a serializer's private context.
LOG_DATE_FORMATS
Timestamp format options for log output.
void logFormatDate(string *out, int dateFormat, uint32 flags, int64 timestamp)
@ LOG_ChannelFirst
Channel between date and level instead of at end.
@ LOG_OmitLevel
Do not include severity level.
@ LOG_BracketChannel
Enclose channel in brackets [net/http].
@ LOG_BracketLevel
Enclose log level in brackets [INFO].
@ LOG_AddColon
Add colon after the prefix.
@ LOG_OmitDate
Do not include a timestamp at all.
@ LOG_IncludeChannel
Include channel path in output.
@ LOG_IncludeContext
Append the log context's fields as [key:value ...].
@ LOG_JustifyLevel
Make level a fixed-width column.
@ LOG_ShortLevel
Use single-character level abbreviations.
@ LOG_LocalTime
Use local time instead of UTC.
@ LOG_DateISO
ISO 8601: "2026-01-02T15:04:05Z", or with a zone offset.
@ LOG_DateTimeOnlyMsec
Time of day only, with milliseconds: "15:04:05.123".
@ LOG_DateSyslog
Syslog format: "Jan 2 15:04:05".
@ LOG_DateISOCompact
Compact ISO: "2026-01-02 15:04:05".
@ LOG_DateISOCompactMsec
Compact ISO with milliseconds: "2026-01-02 15:04:05.123".
@ LOG_DateTimeOnly
Time of day only, no calendar date: "15:04:05".
@ LOG_DateNCSA
NCSA Common Log format: "02/Jan/2026:15:04:05 +00 00".
#define stvar(typen, val)
Configuration for the NDJSON serializer.
uint32 flags
Bitwise OR of LOG_FLAGS values; only LOG_LocalTime is consulted.
A record serializer, owned by whichever transport it was handed to.
void * userdata
Serializer-private context.
LogSerializeFunc serialize
Called once per record.
LogSerializerClose close
Optional; called when the owning transport closes.
uint32 flags
Bitwise OR of LOG_FLAGS values.
int dateFormat
Date format from LOG_DATE_FORMATS; ignored under LOG_OmitDate.
int spacing
Spaces between the prefix and the message (0 defaults to 2)