Core Concepts
The mental model behind Pharos Triton — how the static logger, builder, templates, buffering, and transactions fit together before you write any logging code.
Before we get into batch jobs, LWC, Flows, and the finer points of taxonomy, it's worth spending a few minutes on the mental model. Triton is small on purpose — once these five ideas click, everything else in the docs is just a variation on them.
Here's the whole framework in one breath: you describe a log with a builder, you hand that builder to Triton, and Triton keeps the running state of your transaction — the buffer, the transaction id, your template — statically, for the life of the Apex transaction. That's it. The rest is detail.
The five ideas
The static API
You call Triton directly — Triton.info(...), Triton.error(...) — no instances to manage.
The builder & templates
A fluent TritonBuilder describes one log; a template stamps shared fields onto all of them.
Log levels
Levels rank severity and let you tune verbosity per environment without touching code.
Buffering & flushing
Logs queue in memory and publish in bulk, so you don't burn platform-event allocations.
A first log
Here's what a complete, buffered log looks like in Triton 2.0:
Triton.log(Triton.makeBuilder()
.category(TritonTypes.Category.Apex)
.type(TritonTypes.Type.Backend)
.area(TritonTypes.Area.Accounts)
.summary('Recalculated account rollups')
.level(TritonTypes.Level.INFO));
Triton.flush();Three moves, every time:
Build the log with a builder (
Triton.makeBuilder()gives you one, pre-set to theApexcategory).Hand it to
Triton— hereTriton.log(...)adds it to the buffer.Flush when you're ready to publish. (Need it persisted immediately? Use
Triton.logNow(...)and skip the separate flush.)
If that looks like more ceremony than you want to repeat, good — that's exactly what templates and the convenience level methods are for. The example above collapses to a one-liner once you've set a template:
Where to go next
If you like learning top-down, read the five pages above in order — each builds on the last. If you'd rather learn by doing, jump straight to your context: Logging in Apex, Logging in LWC, or Logging in Flow.
Last updated