> 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/beyond-apex.md).

# Logging in LWC

Logging from Lightning Web Components — the JavaScript Triton API, transaction management, correlating LWC with Apex, and profiling component performance.

Not everything happens in Apex. A modern Salesforce org is a mix of technologies, and the front end — Lightning Web Components — is where users actually live. When a screen misbehaves, "it worked on my machine" isn't a debugging strategy. Triton gives LWC the same structured logging you get in Apex, plus a few things only the browser can offer: runtime info, render timing, and user-interaction telemetry.

The JavaScript API mirrors the Apex one closely — a fluent builder, buffered vs. immediate logging, transactions, templates — so if you know one, you mostly know the other. Grab the logger like any other LWC module:

{% code lineNumbers="true" %}

```javascript
import Triton, { TYPE, AREA, LEVEL } from 'c/triton';
```

{% endcode %}

{% code lineNumbers="true" %}

```javascript
this.triton = new Triton().bindToComponent('MyComponent');

this.triton.log(
    this.triton.info(TYPE.FRONTEND, AREA.ACCOUNTS)
        .summary('Component ready')
);
```

{% endcode %}

## What's in this section

| Page                                                                  | What you'll learn                                                                       |
| --------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| [LWC](/beyond-apex/lwc.md)                                            | The JS logger, component binding, the builder, buffered vs. immediate, templates.       |
| [LWC Transaction Management](/beyond-apex/lwctransaction.md)          | How transactions are auto-managed, the auto-flush monitor, and manual control.          |
| [LWC and Apex](/beyond-apex/lwc-and-apex.md)                          | Correlating a click on the front end with the Apex it triggers.                         |
| [Platform Cache for Transactions](/beyond-apex/lwc-and-apex-cache.md) | Sharing a transaction id across contexts without passing it by hand.                    |
| [Profiling](/beyond-apex/profiling.md)                                | Capturing performance telemetry — backend calls, interactions, lifecycle, custom marks. |

{% hint style="info" %}
Work through the pages in order if you're new to LWC logging — each builds on the last. Once your front end and back end both log to Triton, the natural next step is stitching an entire user journey (LWC → Apex → Flow) into one trace: see [End-to-End Logging](/end-to-end.md).
{% endhint %}

Logging from Flow is its own thing — declarative, no JavaScript — and lives in [Logging in Flow](/flows.md).
