Skip to content

Transports

A transport is what actually emits a log entry: to stdout, to a file, to a third-party logger like zerolog or zap, to a remote service. The core LogLayer assembles the entry; the transport renders it.

Available transports

Renderers

Self-contained transports that format the entry and write it to an io.Writer. Pick one of these when you want LogLayer to do the rendering itself.

NameDescription
PrettyColorized, theme-aware terminal output. Recommended for local dev.
StructuredOne JSON object per log entry. Recommended for production.
ConsolePlain fmt.Println-style output to stdout/stderr; minimal formatting.
TestingCaptures entries in memory for tests.
BlankDelegates dispatch to a user-supplied function. For prototyping or one-off integrations.

Network

Transports that ship log entries to a remote endpoint over the network. Async + batched by default.

NameDescription
HTTPGeneric batched HTTP POST to any endpoint. Pluggable Encoder.
DatadogDatadog Logs HTTP intake. Site-aware URL, DD-API-KEY header, status mapping.

Supported Loggers

Transports that hand the entry off to an existing third-party logger you already configure. Pick one of these when you have an established logging stack and want LogLayer's API on top.

NameDescription
ZerologWraps a *zerolog.Logger
ZapWraps a *zap.Logger
log/slogWraps a stdlib *slog.Logger. Forwards WithContext to handlers.
phuslu/logHigh-performance zero-alloc JSON logger. Always exits on fatal.
logrusThe classic structured logger
charmbracelet/logPretty terminal-friendly logger from Charm
OpenTelemetry LogsEmits to an OTel log.Logger. Forwards WithContext so SDK processors can correlate with the active span.

A single LogLayer can fan out to several transports at once, see Multiple Transports. To wrap a logger LogLayer doesn't ship a transport for, see Creating Transports.