Documentation
¶
Overview ¶
Implementing a custom Transport (renderer / "flatten" policy).
This example demonstrates the policy used by the structured / pretty / console transports: every shape of metadata (map, struct, scalar) is flattened to root-level fields via transport.MergeFieldsAndMetadata.
Reach for this pattern when your backend writes flat key=value lines or a flat JSON object. For an attribute-style backend (zerolog, zap, OTel) see examples/custom-transport-attribute. For an encoder over a protocol (HTTP, Datadog) see transports/datadog/datadog.go.
Run:
go run ./examples/custom-transport
Click to show internal directories.
Click to hide internal directories.