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

# LogBuilder

Triton utilizes the builder design pattern to enable a quick and easy-to-read log creation routine.

## pharos.LogBuilder

This is a global managed class provided with the Pharos managed package. These methods aren't accessible for editing locally. For an overview of the builder class please refer to [this section](https://triton.pharos.ai/core-concepts/builder-and-templates.md).

{% hint style="info" %}
This class is used by [TritonBuilder](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritonbuilder.md) that provides an abstraction layer over this managed class. The documentation here is provided mostly just for reference. For all practical purposes you can skip this class go straight to [TritonBuilder](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritonbuilder.md).
{% endhint %}

### getInstance()

{% code lineNumbers="true" %}

```apex
global static LogBuilder getInstance()
```

{% endcode %}

This is a static method to create a new instance of the builder. Note that this is the only option to instantiate the builder class as the constructor is private.

### type(String value)

{% code lineNumbers="true" %}

```apex
global LogBuilder type(String value)
```

{% endcode %}

This method sets the type value on the log record (see [Type enum](https://triton.pharos.ai/core-concepts/enums.md)).

### summary(String value)

{% code lineNumbers="true" %}

```apex
global LogBuilder summary(String value)
```

{% endcode %}

This method sets the summary value on the log record. Summary will be truncated automatically to 255 characters as necessary.

### details(String value)

{% code lineNumbers="true" %}

```apex
global LogBuilder details(String value)
```

{% endcode %}

This method sets the details value on the log record.

### category(String value)

{% code lineNumbers="true" %}

```apex
global LogBuilder category(String value)
```

{% endcode %}

This method sets the category value on the log record (see [Category enum](https://triton.pharos.ai/core-concepts/enums.md)).

### stackTrace(String value)

{% code lineNumbers="true" %}

```apex
global LogBuilder stackTrace(String value)
```

{% endcode %}

This method sets the stack trace on the log record. Pharos will use this value to render a graphical stack trace for Apex code. For everything else, a text representation of the stack trace will be provided.

### area(String value)

{% code lineNumbers="true" %}

```apex
global LogBuilder area(String value)
```

{% endcode %}

This method sets the area (functional area) value on the log record (see [Area enum](https://triton.pharos.ai/core-concepts/enums.md)).

### postProcessing(String settingsJSON)

{% code lineNumbers="true" %}

```apex
global LogBuilder postProcessing(String settingsJSON)
```

{% endcode %}

This method sets the post processing controls that signal to Pharos the types of post processing to perform on a log record. Use the [*PostProcessingControlsBuilder*](https://triton.pharos.ai/methods-reference/apex-methods-reference/tritonhelper/postprocessingcontrolsbuilder.md) to build the settings and serialize them to JSON.

### transactionId(String value)

{% code lineNumbers="true" %}

```apex
global LogBuilder transactionId(String value)
```

{% endcode %}

This method sets the transaction Id on a log record.

### createIssue()

{% code lineNumbers="true" %}

```apex
global LogBuilder createIssue()
```

{% endcode %}

Calling this method will signal to Pharos to create an Issue from this log record. By default, no Issue records are created for custom logs.

### attribute(String field, Object value)

<pre class="language-apex"><code class="lang-apex"><strong>global LogBuilder attribute(String field, Object value)
</strong></code></pre>

This methods set any field on a log record to the specified value. Please refer to [this section](https://triton.pharos.ai/core-concepts/builder-and-templates.md#custom-attributes) for more details.

### build()

{% code lineNumbers="true" %}

```apex
global pharos__Log__c build()
```

{% endcode %}

This methods will return the final log record. Call this method once you've set all the attributes. The output of this method can be provided to the [logging methods](https://triton.pharos.ai/methods-reference/apex-methods-reference.md).
