Builder Classes

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.

getInstance()

global static LogBuilder getInstance()

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)

global LogBuilder type(String value)

This method sets the type value on the log record (see Type enum).

summary(String value)

global LogBuilder summary(String value)

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

details(String value)

global LogBuilder details(String value)

This method sets the details value on the log record.

category(String value)

global LogBuilder category(String value)

This method sets the category value on the log record (see Category enum).

stackTrace(String value)

global LogBuilder stackTrace(String value)

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)

global LogBuilder area(String value)

This method sets the area (functional area) value on the log record (see Area enum).

postProcessing(String settingsJSON)

global LogBuilder postProcessing(String settingsJSON)

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 to build the settings and serialize them to JSON.

transactionId(String value)

global LogBuilder transactionId(String value)

This method sets the transaction Id on a log record.

createIssue()

global LogBuilder createIssue()

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)

global LogBuilder attribute(String field, Object value)

This methods set any field on a log record to the specified value. Please refer to this section for more details.

build()

global pharos__Log__c build()

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.

TritonTypes.PostProcessingControlsBuilder

This builder class provides a quick and easy way to set post processing flags. It can be found inside the TritonTypes.cls. These flags determine what type of post processing Pharos performs for a log record.

setAll(Boolean value)

public PostProcessingControlsBuilder setAll(Boolean value)

Sets all flags according to the Boolean value provided.

value -- Boolean value to set all flags to

stackTrace(Boolean value)

public PostProcessingControlsBuilder stackTrace(Boolean value)

Sets the stack trace post processing control. This is only applicable to Apex and Integration logs. When this value is set for an Apex log, Pharos will fetch a context-enriched stack strace and render a view showing several lines around each of the stack trace entries. When this value is set to true for an Integration category log, Pharos will render a Postman-like view of the request and response payloads provided with the log record.

value -- Boolean value to set

userInfo(Boolean value)

public PostProcessingControlsBuilder userInfo(Boolean value)

Sets the user info post-processing control. If set to true, Pharos will automatically fetch the first and last name of the user based on user Id value from a log record. This will be used to show a link to the user record from the log detail page.

value -- boolean value to set

objectInfo(Boolean value)

public PostProcessingControlsBuilder objectInfo(Boolean value)

Sets the object info post processing control. If set to true, Pharos will automatically fetch the label of the related record based on related object Id value from a log record.

value -- Boolean value to set

relatedObjects(Boolean value)

public PostProcessingControlsBuilder relatedObjects(Boolean value)

Sets the related objects post processing control. If set to true Pharos will automatically fetch all labels of related object records based on related object Ids value from a log record.

value -- boolean value to set

deployResult(Boolean value)

public PostProcessingControlsBuilder deployResult(Boolean value)

Sets the deploy result post processing control. If set to true Pharos will automatically fetch the 10 most recent deployments that took place in your org.

value -- Boolean value to set

auditTrail(Boolean value)

public PostProcessingControlsBuilder auditTrail(Boolean value)

Sets the audit trail post processing control. If set to true Pharos will automatically fetch the org audit trail for the last 48 hours (if available).

value -- Boolean value to set

pendingJobs(Boolean value)

public PostProcessingControlsBuilder pendingJobs(Boolean value)

Sets the pending jobs post processing control. If set to true Pharos will automatically fetch all pending jobs currently in the flex queue.

value -- Boolean value to set

totalActiveSession(Boolean value)

public PostProcessingControlsBuilder totalActiveSession(Boolean value)

Sets the active sessions post processing control. If set to true Pharos will automatically fetch the total number of logged in users (active sessions).

value -- Boolean value to set

installedPackages(Boolean value)

public PostProcessingControlsBuilder installedPackages(Boolean value)

Sets the installed packages post processing control. If set to true Pharos will automatically fetch the names of all installed managed and unmanaged packages.

value -- Boolean value to set

build()

public String build()

Returns an instance of the post processing controls in JSON format. Pass the output of this method to the postProcessing() method in the pharos.LogBuilder class as described here.

Last updated