TritonBuilder
The TritonBuilder class provides a comprehensive and flexible API for creating structured log records in Salesforce.
TritonBuilder
Overview
The TritonBuilder class is a builder pattern implementation for creating and configuring Pharos log records in Salesforce. It provides a fluent interface to set various attributes like category, type, area, related objects, and other metadata for logging purposes. This class wraps the core pharos.LogBuilder to offer a more user-friendly API for log creation.
Constructor
TritonBuilder()
Description: Initializes a new instance of the
TritonBuilderclass, setting default attributes such as the created timestamp and request ID.Usage:
TritonBuilder builder = new TritonBuilder();
Methods
category(TritonTypes.Category c)
Description: Sets the log category from the
Categoryenum.Parameters:
c:TritonTypes.Categoryenum value.
Returns:
TritonBuilderinstance.Usage:
builder.category(TritonTypes.Category.Apex);
type(TritonTypes.Type t)
Description: Sets the log type from the
Typeenum.Parameters:
t:TritonTypes.Typeenum value.
Returns:
TritonBuilderinstance.Usage:
type(String t)
Description: Sets the log type to a string value, useful when creating a log from an exception.
Parameters:
t: String value.
Returns:
TritonBuilderinstance.Usage:
area(TritonTypes.Area a)
Description: Sets the log functional area from the
Areaenum.Parameters:
a:TritonTypes.Areaenum value.
Returns:
TritonBuilderinstance.Usage:
area(String a)
Description: Sets the log functional area to a string value, useful from flows.
Parameters:
a: String value.
Returns:
TritonBuilderinstance.Usage:
level(TritonTypes.Level l)
Description: Sets the log level from the
Levelenum.Parameters:
l:TritonTypes.Levelenum value.
Returns:
TritonBuilderinstance.Usage:
operation(String operation)
Description: Sets the operation from a string value.
Parameters:
operation: String value.
Returns:
TritonBuilderinstance.Usage:
summary(String value)
Description: Sets the log summary from a string value.
Parameters:
value: String value.
Returns:
TritonBuilderinstance.Usage:
details(String value)
Description: Sets the log details from a string value.
Parameters:
value: String value.
Returns:
TritonBuilderinstance.Usage:
stackTrace(String stack)
Description: Sets the stack trace from a string value.
Parameters:
stack: String value.
Returns:
TritonBuilderinstance.Usage:
postProcessing(TritonHelper.PostProcessingControlsBuilder postProcessingBuilder)
Description: Sets post-processing metadata from a
PostProcessingControlsBuilderinstance.Parameters:
postProcessingBuilder: Instance ofTritonHelper.PostProcessingControlsBuilder.
Returns:
TritonBuilderinstance.Usage:
transactionId(String transactionId)
Description: Sets the transaction ID from a string.
Parameters:
transactionId: String value.
Returns:
TritonBuilderinstance.Usage:
createIssue()
Description: Marks the log to create an issue or associate with an existing one.
Returns:
TritonBuilderinstance.Usage:
userId(Id userId)
Description: Sets the user ID for the log.
Parameters:
userId: ID of the user to associate with the log.
Returns:
TritonBuilderinstance.Usage:
relatedObject(Id objectId)
Description: Adds a single related object ID to the log.
Parameters:
objectId: ID of the object to relate to the log.
Returns:
TritonBuilderinstance.Usage:
relatedObject(String objectId)
Description: Adds a single related object ID string to the log.
Parameters:
objectId: String representation of the ID to relate to the log.
Returns:
TritonBuilderinstance.Usage:
relatedObjects(List relatedObjectIds)
Description: Adds multiple related object IDs to the log.
Parameters:
relatedObjectIds: List of IDs to relate to the log.
Returns:
TritonBuilderinstance.Usage:
relatedObjects(Set relatedObjectIds)
Description: Adds multiple related object ID strings to the log.
Parameters:
relatedObjectIds: Set of ID strings to relate to the log.
Returns:
TritonBuilderinstance.Usage:
createdTimestamp(Double timestamp)
Description: Sets the created timestamp for the log.
Parameters:
timestamp: Double value representing the creation timestamp.
Returns:
TritonBuilderinstance.Usage:
duration(Decimal duration)
Description: Sets the duration for the log.
Parameters:
duration: Decimal value representing the duration.
Returns:
TritonBuilderinstance.Usage:
integrationPayload(HttpRequest request, HttpResponse response)
Description: Sets the integration payload from HTTP request/response.
Parameters:
request:HttpRequestinstance.response:HttpResponseinstance.
Returns:
TritonBuilderinstance.Usage:
integrationPayload(RestRequest request, RestResponse response)
Description: Sets the integration payload from REST request/response.
Parameters:
request:RestRequestinstance.response:RestResponseinstance.
Returns:
TritonBuilderinstance.Usage:
interviewGuid(String guid)
Description: Sets the interview GUID for the log.
Parameters:
guid: String value of the interview GUID.
Returns:
TritonBuilderinstance.Usage:
flowApiName(String apiName)
Description: Sets the flow API name for the log.
Parameters:
apiName: String value of the flow API name.
Returns:
TritonBuilderinstance.Usage:
attribute(String name, Object value)
Description: Sets a custom attribute on the log.
Parameters:
name: String name of the attribute.value: Object value of the attribute.
Returns:
TritonBuilderinstance.Usage:
build()
Description: Builds and returns the log record.
Returns:
pharos__Log__cinstance.Usage:
Last updated