Logger / PIL Ingress

Define Once. Emit Changes.

Typed events from your application to Trie-Trunk.
Negotiate the Definition before the first write.

Connect With a Definition

The Go logger accepts your compiled resource map.
Already encoded PIL frames can be submitted together.

PIL LoggerGo · Inside Your Application
mapBytes, err := os.ReadFile("resource.map")
if err != nil { return err }

logger, err := pil.Open(ctx, pil.Config{
    URL:        trunkURL,
    Cache:      "prod",
    Branch:     "write",
    Token:      token,
    Definition: mapBytes,
})
if err != nil { return err }
defer logger.Close()

// PIL frames encoded against the producer Definition.
return logger.WriteFrames(ctx, frames...)

Import trie-trunk/go/logger/pil. Use WriteValues to encode positional values directly into the accepted layout.

From Application to Journal

One Definition binds the producer and receiver.
Partial changes keep their original meaning.

Register

Exchange Definition identity and digest. Send missing maps, validate compatible server layouts, and prepare the encoder before delivery.

Definition → Accepted Layout

Batch & Deliver

Send immediately or configure a millisecond batching window for concurrent producers. HTTP gzip can compress the entire batch; revisions are preserved without coalescing.

PIL Frames → HTTP → .seed

Handle Failures

Observe delivery errors and retain event identities for retries. A successful call requires the server’s staging acknowledgement; queueing alone is not success.

event_id → Delivery Identity

Requests & Object Changes

The request-scoped logger supplies a fluent builder, HTTP middleware, durations, and checkpoints through client.NewPIL. A request completion does not imply a committed object mutation.

Use the generic PIL logger for explicit object changes. Define object identity and revision roles when collection replay is enabled. Omitted fields remain absent; null remains an explicit value.

Definitions can allow @fields for extensions. Compatible newer Definitions can promote these values into typed fields without renaming them.

Request Logger Reference