Skip to main content

Module trace

Module trace 

Source
Expand description

Opt-in input tracing.

An input bug is a sequence bug: the sample that mattered is three packets back, and by the time a widget misbehaves the evidence is gone. Rather than reach for a logging framework (teksilo-core has seven dependencies and intends to keep them), the input layer carries one environment-variable switch and one macro.

TEKSILO_TRACE_INPUT=samples   # every pointer and scroll sample
TEKSILO_TRACE_INPUT=gestures  # recognizer transitions and arbitration
TEKSILO_TRACE_INPUT=all       # both

A line looks like:

[teksilo input] down PointerId(2) at Point { x: 120.0, y: 44.0 }

§Cost when off

The variable is read once, through a OnceLock, so a trace_enabled call after the first is one relaxed load and a comparison. More importantly trace_input! guards its arguments: a trace call in a hot path formats nothing, allocates nothing and evaluates none of its argument expressions unless the level is on. That is what makes it acceptable to leave a trace call on the per-sample path.

Enums§

TraceLevel
How much input tracing is on.

Functions§

trace_enabled
Whether level is currently being traced.
trace_level
The active trace level.