Skip to content

logEntryBuilder

Functions

setMessage(message)LogEntryBuilder

Sets the log entry event's message field

setRecordId(recordId)LogEntryBuilder

Sets the log entry event's record fields

setRecord(record)LogEntryBuilder

Sets the log entry event's record fields

setScenario(scenario)LogEntryBuilder

Sets the log entry event's scenario field

setError(error)LogEntryBuilder

Deprecated - use setExceptionDetails(exception) instead The name of this method is very similar to the logger function logger.error(), resulting in confusion when used together: logger.error('Unexpected error').setError(someErrorObject); The new setExceptionDetails(exception) function provides the exact same functionality, but aligns with the Apex builder's method name, and helps reduce the confusion with logger.error()

setExceptionDetails(exception)LogEntryBuilder

Sets the log entry event's exception fields

setField(fieldToValue)LogEntryBuilder

Sets multiple field values on the builder's LogEntryEvent__e record

parseStackTrace(originStackTraceError)LogEntryBuilder

Parses the provided error's stack trace and sets the log entry's origin & stack trace fields

addTag(tag)LogEntryBuilder

Appends the tag to the existing list of tags

addTags(tags)LogEntryBuilder

Appends the tag to the existing list of tags

getComponentLogEntry()ComponentLogEntry

Returns the object used to save log entry data

setMessage(message) ⇒ LogEntryBuilder

Sets the log entry event’s message field

Kind: global function
Returns: LogEntryBuilder - The same instance of LogEntryBuilder, useful for chaining methods

ParamTypeDescription
messageStringThe string to use to set the entry’s message field

setRecordId(recordId) ⇒ LogEntryBuilder

Sets the log entry event’s record fields

Kind: global function
Returns: LogEntryBuilder - The same instance of LogEntryBuilder, useful for chaining methods

ParamTypeDescription
recordIdStringThe ID of the SObject record related to the entry

setRecord(record) ⇒ LogEntryBuilder

Sets the log entry event’s record fields

Kind: global function
Returns: LogEntryBuilder - The same instance of LogEntryBuilder, useful for chaining methods

ParamTypeDescription
recordObjectThe SObject record related to the entry. The JSON of the record is automatically added to the entry

setScenario(scenario) ⇒ LogEntryBuilder

Sets the log entry event’s scenario field

Kind: global function
Returns: LogEntryBuilder - The same instance of LogEntryBuilder, useful for chaining methods

ParamTypeDescription
scenarioStringThe string to use to set the entry’s scenario field

setError(error) ⇒ LogEntryBuilder

Deprecated - use setExceptionDetails(exception) instead The name of this method is very similar to the logger function logger.error(), resulting in confusion when used together: logger.error('Unexpected error').setError(someErrorObject); The new setExceptionDetails(exception) function provides the exact same functionality, but aligns with the Apex builder’s method name, and helps reduce the confusion with logger.error()

Kind: global function
Returns: LogEntryBuilder - The same instance of LogEntryBuilder, useful for chaining methods

ParamTypeDescription
errorErrorThe instance of a JavaScript Error object to use, or an Apex HTTP error to use

setExceptionDetails(exception) ⇒ LogEntryBuilder

Sets the log entry event’s exception fields

Kind: global function
Returns: LogEntryBuilder - The same instance of LogEntryBuilder, useful for chaining methods

ParamTypeDescription
exceptionErrorThe instance of a JavaScript Error object to use, or an Apex HTTP error to use

setField(fieldToValue) ⇒ LogEntryBuilder

Sets multiple field values on the builder’s LogEntryEvent__e record

Kind: global function
Returns: LogEntryBuilder - The same instance of LogEntryBuilder, useful for chaining methods

ParamTypeDescription
fieldToValueObjectAn object containing the custom field name as a key, with the corresponding value to store. Example: {"SomeField__c": "some value", "AnotherField__c": "another value"}

parseStackTrace(originStackTraceError) ⇒ LogEntryBuilder

Parses the provided error’s stack trace and sets the log entry’s origin & stack trace fields

Kind: global function
Returns: LogEntryBuilder - The same instance of LogEntryBuilder, useful for chaining methods

ParamTypeDescription
originStackTraceErrorErrorThe instance of a JavaScript Error object with a stack trace to parse

addTag(tag) ⇒ LogEntryBuilder

Appends the tag to the existing list of tags

Kind: global function
Returns: LogEntryBuilder - The same instance of LogEntryBuilder, useful for chaining methods

ParamTypeDescription
tagStringThe string to add as a tag for the current log entry

addTags(tags) ⇒ LogEntryBuilder

Appends the tag to the existing list of tags

Kind: global function
Returns: LogEntryBuilder - The same instance of LogEntryBuilder, useful for chaining methods

ParamTypeDescription
tagsArray.<String>The list of strings to add as tags for the current entry

getComponentLogEntry() ⇒ ComponentLogEntry

Returns the object used to save log entry data

Kind: global function
Returns: ComponentLogEntry - An instance of ComponentLogEntry that matches the Apex class ComponentLogger.ComponentLogEntry