DebugTransport

class DebugTransport(delegate: Transport, log: (String) -> Unit = ::println) : Transport

Wraps delegate, logging every event before delivering it — for eyeballing outgoing events on a real device/build during manual QA, separate from the app's production transport. Not connected to a warehouse or any assertion tooling (see the planned autograph-test module for unit-test assertions instead).

The default log (println) dumps every event's full properties/traits — do not wrap a production transport with this in a release build, since that can leak PII into device/console logs. Gate its use behind a debug-build check, or supply a log that redacts what it prints.

val tracker = Autograph {
transport(DebugTransport(SegmentTransport(analytics)))
}

When delegate stamps in its own pipeline (Transport.stampsInPipeline), the envelope isn't known yet at the point this wrapper sees the event (the delegate stamps it later, inside its own pipeline) — the logged line shows envelope=null in that case, matching what delegate itself receives.

Constructors

Link copied to clipboard
constructor(delegate: Transport, log: (String) -> Unit = ::println)

Properties

Link copied to clipboard
open override val stampsInPipeline: Boolean

True when this transport calls EnvelopeSource.stamp inside its own pipeline. In that case the core passes envelope = null to the event methods and the transport is responsible for stamping every event exactly once.

Functions

Link copied to clipboard
open override fun connect(envelopes: EnvelopeSource)

Called once during setup, before any events are sent.

Link copied to clipboard
open override fun flush()
Link copied to clipboard
open override fun identify(userId: String, traits: JsonObject, envelope: Envelope?)
Link copied to clipboard
open override fun reset()
Link copied to clipboard
open override fun screen(name: String, properties: JsonObject, envelope: Envelope?)
Link copied to clipboard
open override fun track(name: String, properties: JsonObject, envelope: Envelope?)