ilusm.dev

trcx

Tracing domain - a thin convenience facade over obs. Exposes timeline access, JSON timeline, emit, call stack, structured log entry, info, warning, and error log helpers under short trcx* names.

Load with: use trcx

What this module does

trcx is a minimal tracing adapter that re-exports the most common obs operations under shorter names. Use it when you want structured tracing but don't need the full obs surface directly. The underlying storage and emission behaviour is determined by obs.

Quick example

use trcx

# Log at different levels
trcxi({event: "request", method: "GET", path: "/api/v1"})
trcxw({event: "slow_query", ms: 1200})
trcxe({event: "db_error", msg: "connection refused"})

# Write a structured log entry
trcxl({span: "auth", user: "alice", ok: tru})

# Get call stack
stack = trcxs()

Functions

Timeline

trcxt()

Returns the current obs timeline (delegates to obstl, obstljson, or obstlemit depending on variant).

trcxs()

Returns the current obs call stack (obsstack).

Logging

trcxl(data)

Writes a structured log entry via obslogent. Returns nil.

trcxi(data)

Logs at INFO level via obsinf.

trcxw(data)

Logs at WARN level via obswrn.

trcxe(data)

Logs at ERROR level via obserr.

Notes

  • All behaviour (storage, sinks, format) is inherited from obs.
  • Requires obs.