Expand description
Canonical container-logs wire codec shared by zlayer-api (the
serializer) and zlayer-docker (the parser that re-frames our NDJSON as
Docker logs).
Before this module existed, the native NDJSON log wire shape was defined
ad-hoc in exactly one place — zlayer-api’s ndjson_line_for_chunk — with
no decoder and no shared type. This module is the single source of truth for
that shape so both ends agree byte-for-byte.
§Wire shape
Each log record is a JSON object followed by a trailing \n (NDJSON):
{"stream":"stdout","timestamp":"2026-05-03T12:00:00+00:00","data":"hello\n"}stream— one of"stdin","stdout","stderr".timestamp— OPTIONAL (omitted when absent): an RFC3339 string produced bychrono::DateTime::to_rfc3339(e.g.2026-05-03T12:00:00+00:00).- payload — exactly one of:
data— the UTF-8 string, when the raw bytes are valid UTF-8; ordata_b64— STANDARD base64 of the raw bytes, when they are not.
Structs§
- Docker
Frame TooLarge - Error returned by
encode_docker_frame/LogLine::to_docker_framewhen a payload is too large to encode in a Docker multiplexed-stream frame, whose length field is a big-endianu32. The wrapped value is the offending payload length in bytes. - LogLine
- One framed log record on the canonical NDJSON wire.
Enums§
- LogStream
Kind - Which standard stream a
LogLinebelongs to.
Functions§
- encode_
docker_ frame - Encode a single Docker multiplexed-stream frame: an 8-byte header followed by
the raw
payloadbytes. - error_
ndjson_ line - Build a unified error frame:
{"error":"<message>"}\n.