> For the complete documentation index, see [llms.txt](https://triton.pharos.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://triton.pharos.ai/methods-reference/apex-methods-reference.md).

# Apex

This article covers the base Apex methods you'll need to create log records.

## File Index

#### [`Triton.cls`](https://triton.pharos.ai/methods-reference/apex-methods-reference/triton.md)

The main class that provides the core logging functionality through a fully static API:

* Static entry point — no instance to manage
* Builder creation and reusable templates
* Buffered (`log`) and immediate (`logNow`) logging, plus per-level shorthands
* Transaction tracking across Apex, LWC, and Flow contexts (optionally cache-backed)
* Configurable log levels via Custom Metadata

#### [`TritonBuilder.cls`](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritonbuilder.md)

A builder class that provides a fluent interface for creating log records:

* Wraps the core `pharos.LogBuilder` to provide a user-friendly API
* Handles setting of various log attributes (category, type, area, etc.)
* Manages related objects and metadata
* Supports integration payload formatting
* Handles transaction IDs and user context

#### [`TritonTypes.cls`](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritontypes.md)

Defines the classification system and enums used throughout the framework:

* `Area`: Functional areas from a business perspective (e.g., OpportunityManagement, RestAPI)
* `Category`: The technology that produced the log (e.g., Apex, Flow, LWC)
* `Level`: Log severity levels (ERROR to FINEST)
* `Type`: Technical classification (e.g., Backend, Frontend, DMLResult)

### Context-Specific Components

#### [`TritonLwc.cls`](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritonlwc.md)

Provides logging capabilities specifically for Lightning Web Components:

* Exposes AuraEnabled methods for LWC logging
* Handles component context capture
* Manages error details and stack traces
* Captures detailed runtime information (performance, memory, network)
* Supports transaction management

#### [`TritonFlow.cls`](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritonflow.md)

Enables logging from Salesforce Flows and Process Builder:

* Provides invocable methods for Flow Builder
* Handles Flow context capture (Interview GUID, Flow API Name)
* Supports custom field mapping through JSON
* Manages automatic transaction tracking
* Validates and defaults log levels and categories

### Utility Components

#### [`TritonHelper.cls`](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritonhelper.md)

Provides utility methods and builder classes:

* The single publish path, which never throws (`publishLogs`)
* Runtime configuration and log-level evaluation (`TritonHelper.Config`)
* Log level comparison
* UUID generation for transaction tracking
* HTTP request/response JSON serialization
* Transaction caching functionality
* Message formatting utilities
* Runtime information formatting
* Stack trace processing

#### [`TritonCacheManager.cls`](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritoncachemanager.md)

Centralizes Salesforce Platform Cache operations (Org cache), with a test-friendly mock backend. Backs cache-based transaction management and Flow-log buffering.

#### [`TritonFlowFlushBatch.cls`](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritonflowflushbatch.md)

Singleton batch that defers and consolidates Flow log publishing to minimize platform event consumption.

#### [`TritonTestFactory.cls`](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritontestfactory.md)

Shared `@IsTest` helper providing setup, record-creation, flush, query, assertion, and fault-injection utilities for Triton tests.

#### `TritonSpanContext.cls`

The in-memory span stack behind [performance marks](https://triton.pharos.ai/common-apex-usage-patters/performance-marks.md). `Triton` uses it internally; you don't call it directly.

#### `LogLimitsController.cls`

Serves `getLimitUsage(logId)` to the **Log Limits** component on the Log record page. See [Add the Log Limits component](https://triton.pharos.ai/installing-pharos-triton.md#add-the-log-limits-component-to-the-log-page).

### Runtime Information Components

#### [`RuntimeInfo` (in TritonLwc)](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritonlwc/runtimeinfo.md)

Captures detailed runtime information from Lightning Web Components:

* Environment details (user agent, platform, language)
* Performance metrics (page load time, DOM events, paint times)
* Memory usage statistics
* Network information (connection type, speed, RTT)
* Device characteristics (form factor, screen dimensions)
* Navigation context (pathname, hostname)
