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 newsetExceptionDetails(exception)function provides the exact same functionality, but aligns with the Apex builder's method name, and helps reduce the confusion withlogger.error()- setExceptionDetails(exception) ⇒
LogEntryBuilder Sets the log entry event's exception fields
- setField(fieldToValue) ⇒
LogEntryBuilder Sets multiple field values on the builder's
LogEntryEvent__erecord- 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
| Param | Type | Description |
|---|---|---|
| message | String | The 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
| Param | Type | Description |
|---|---|---|
| recordId | String | The 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
| Param | Type | Description |
|---|---|---|
| record | Object | The 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
| Param | Type | Description |
|---|---|---|
| scenario | String | The 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
| Param | Type | Description |
|---|---|---|
| error | Error | The 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
| Param | Type | Description |
|---|---|---|
| exception | Error | The 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
| Param | Type | Description |
|---|---|---|
| fieldToValue | Object | An 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
| Param | Type | Description |
|---|---|---|
| originStackTraceError | Error | The 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
| Param | Type | Description |
|---|---|---|
| tag | String | The 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
| Param | Type | Description |
|---|---|---|
| tags | Array.<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