For the complete documentation index, see llms.txt. This page is also available as Markdown.

Best Practices & Standards

Opinionated, field-tested standards for rolling out Pharos Triton logging across Apex, LWC, and Flow, and keeping it consistent as your org grows.

The Core Concepts tell you how the Triton API works. This section is about how to use it well — the judgment calls that separate logs you're glad you have from noise you'll end up filtering out.

It's written for the person standing up Triton across a real org: architects and senior developers who have to make logging consistent across a dozen teams, a pile of legacy triggers, and every technology Salesforce throws at them (Apex, LWC, Flow). The advice here is opinionated on purpose. When there's a right answer, we'll give it to you.

Everything is on the 2.0 static, builder-first API — Triton.log(Triton.t...), no Triton.instance. If you're coming from 1.x, read Migrating from Triton 1.x to 2.0 first, then come back here.

The short version

If you read nothing else, internalize these five:

  • Build every log the same way. Set a template once per unit of work, then log from Triton.t. Consistency is what makes logs searchable.

  • Buffer the routine, publish the critical. Queue progress logs and flush at boundaries; send exceptions with logNow so you never lose the one that mattered.

  • Log at the right level and let metadata decide. Don't gate logs behind if (debug) — pick a level and tune volume through Log_Level__mdt.

  • Correlate across hops. Start a transaction at the entry point and carry it through LWC → Apex → Flow so one user action reads as one trace.

  • Use the real taxonomy. Category/Type/Area from the enums, extended deliberately — never ad-hoc strings.

How this section is organized

Read it in order the first time; each page assumes the one before it.

Page
What it covers

The handful of ideas the rest of the section is built on, plus the master Do/Don't list.

Picking ERROR vs WARNING vs INFO vs DEBUG, and tuning verbosity per environment.

Setting a template per unit of work and logging from Triton.t.

Conserving platform events without losing critical logs.

Stitching logs together across LWC, Apex, and Flow.

Copy-ready patterns for triggers, batches, queueables, REST, schedulers, LWC, and Flow.

Making each log carry enough context to debug from.

Designing a Category/Type/Area vocabulary that scales.

Turning caught exceptions into actionable, correlated error logs.

Code-review checklists and CI guardrails that keep standards from rotting.

Adding observability to old, poorly-understood code without breaking it.

Why any of this matters. A single user action might cross an LWC, an Apex controller, a Flow, and a callout. When it breaks at 2am, the difference between a five-minute fix and a five-hour investigation is whether those five layers produced one coherent, well-labeled trace — or five disconnected piles of text. The standards here exist to make the first outcome the default.

Last updated