NebulaLogger

The most robust logger for Salesforce. Works with Apex, Lightning Components, Flow, Process Builder & Integrations. Designed for Salesforce admins, developers & architects.

View the Project on GitHub jongpie/NebulaLogger

LoggerDataStore class

Class used to manage any data-related operations, including database DML statements, publishing platform events via the event bus, and enqueueing queueable jobs


Methods

getDatabase()Database

The instance LoggerDataStore.Database used for any DML operations in the current transaction.

Return

Type

Database

Description

The singleton instance of LoggerDataStore.Database

getEventBus()EventBus

The instance LoggerDataStore.EventBus used for publishing platform events in the current transaction.

Return

Type

EventBus

Description

The singleton instance of LoggerDataStore.EventBus

getJobQueue()JobQueue

The instance LoggerDataStore.JobQueue used for enqueuing any queueable jobs in the current transaction.

Return

Type

JobQueue

Description

The singleton instance of LoggerDataStore.JobQueue


Inner Classes

LoggerDataStore.Database class

Class used to centralize the handling of any DML operations


Methods
deleteRecord(SObject record)Database.DeleteResult

Executes a delete DML operation for the SObject record

####### Parameters

Param Description
record The SObject record to delete

####### Return

Type

Database.DeleteResult

Description

The instance of Database.DeleteResult, generated by the platform when deleting the record

deleteRecords(List<SObject> records)List<Database.DeleteResult>

Executes a delete DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to delete

####### Return

Type

List<Database.DeleteResult>

Description

The instance of List&lt;Database.DeleteResult&gt;, generated by the platform when deleting the records

deleteRecords(List<SObject> records, Boolean allOrNone)List<Database.DeleteResult>

Executes a delete DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to delete
allOrNone Controls if all records must be deleted (true), or if partial deletion should be used (false)

####### Return

Type

List<Database.DeleteResult>

Description

The instance of List&lt;Database.DeleteResult&gt;, generated by the platform when deleting the records

hardDeleteRecord(SObject record)Database.DeleteResult

Executes a delete DML operation for the SObject record, followed by hard deleting the record using Database.emptyRecycleBin(record)

####### Parameters

Param Description
record The SObject record to delete

####### Return

Type

Database.DeleteResult

Description

The instance of Database.DeleteResult, generated by the platform when deleting the record

hardDeleteRecords(List<SObject> records)List<Database.DeleteResult>

Executes a delete DML operation on the provided list of SObject records, followed by hard deleting the records using Database.emptyRecycleBin(records)

####### Parameters

Param Description
records The list of SObject records to delete

####### Return

Type

List<Database.DeleteResult>

Description

The instance of List&lt;Database.DeleteResult&gt;, generated by the platform when deleting the records

insertRecord(SObject record)Database.SaveResult

Executes an insert DML operation on the provided SObject record

####### Parameters

Param Description
record The SObject record to insert

####### Return

Type

Database.SaveResult

Description

The instance of Database.SaveResult, generated by the platform when creating the record

insertRecords(List<SObject> records)List<Database.SaveResult>

Executes an insert DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to insert

####### Return

Type

List<Database.SaveResult>

Description

The instance of List&lt;Database.SaveResult&gt;, generated by the platform when creating the records

insertRecords(List<SObject> records, Boolean allOrNone)List<Database.SaveResult>

Executes an insert DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to insert
allOrNone Controls if all records must be created (true), or if partial creation should be used (false)

####### Return

Type

List<Database.SaveResult>

Description

The instance of List&lt;Database.SaveResult&gt;, generated by the platform when creating the records

insertRecords(List<SObject> records, Database.DmlOptions dmlOptions)List<Database.SaveResult>

Executes an insert DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to insert
dmlOptions Controls additional DML options, using the provided instance of Database.DmlOptions

####### Return

Type

List<Database.SaveResult>

Description

The instance of List&lt;Database.SaveResult&gt;, generated by the platform when creating the records

undeleteRecord(SObject record)Database.UndeleteResult

Executes an undelete DML operation on the provided SObject record

####### Parameters

Param Description
record The SObject record to undelete

####### Return

Type

Database.UndeleteResult

Description

The instance of Database.UndeleteResult, generated by the platform when undeleting the record

undeleteRecords(List<SObject> records)List<Database.UndeleteResult>

Executes an undelete DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to undelete

####### Return

Type

List<Database.UndeleteResult>

Description

The instance of List&lt;Database.UndeleteResult&gt;, generated by the platform when deleting the records

undeleteRecords(List<SObject> records, Boolean allOrNone)List<Database.UndeleteResult>

Executes an undelete DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to undelete
allOrNone Controls if all records must be undeleted (true), or if partial undeletion should be used (false)

####### Return

Type

List<Database.UndeleteResult>

Description

The instance of List&lt;Database.DeleteResult&gt;, generated by the platform when undeleting the records

updateRecord(SObject record)Database.SaveResult

Executes an update DML operation on the provided SObject record

####### Parameters

Param Description
record The SObject record to update

####### Return

Type

Database.SaveResult

Description

The instance of Database.SaveResult, generated by the platform when updating the record

updateRecords(List<SObject> records)List<Database.SaveResult>

Executes an update DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to update

####### Return

Type

List<Database.SaveResult>

Description

The instance of List&lt;Database.SaveResult&gt;, generated by the platform when updating the records

updateRecords(List<SObject> records, Boolean allOrNone)List<Database.SaveResult>

Executes an update DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to update
allOrNone Controls if all records must be updated (true), or if partial updates should be used (false)

####### Return

Type

List<Database.SaveResult>

Description

The instance of List&lt;Database.SaveResult&gt;, generated by the platform when updating the records

updateRecords(List<SObject> records, Database.DmlOptions dmlOptions)List<Database.SaveResult>

Executes an update DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to update
dmlOptions Controls additional DML options, using the provided instance of Database.DmlOptions

####### Return

Type

List<Database.SaveResult>

Description

The instance of List&lt;Database.SaveResult&gt;, generated by the platform when updating the records

upsertRecord(SObject record, Schema.SObjectField externalIdField)Database.UpsertResult

Executes an upsert DML operation on the provided list of SObject records

####### Parameters

Param Description
record The SObject record to update
externalIdField The SObjectField of the external ID field on the target SObject to use for upserting

####### Return

Type

Database.UpsertResult

Description

The instance of Database.UpsertResult, generated by the platform when upserting the record

upsertRecords(List<SObject> records, Schema.SObjectField externalIdField)List<Database.UpsertResult>

Executes an upsert DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to upsert
externalIdField The SObjectField of the external ID field on the target SObject to use for upserting

####### Return

Type

List<Database.UpsertResult>

Description

The instance of List&lt;Database.UpsertResult&gt;, generated by the platform when Upserting the records

upsertRecords(List<SObject> records, Schema.SObjectField externalIdField, Boolean allOrNone)List<Database.UpsertResult>

Executes an upsert DML operation on the provided list of SObject records

####### Parameters

Param Description
records The list of SObject records to upsert
externalIdField The SObjectField of the external ID field on the target SObject to use for upserting
allOrNone Controls if all records must be updated (true), or if partial updates should be used (false)

####### Return

Type

List<Database.UpsertResult>

Description

The instance of List&lt;Database.UpsertResult&gt;, generated by the platform when Upserting the records


LoggerDataStore.EventBus class

Class used to centralize the handling of any platform event publishing operations


Methods
publishRecord(SObject platformEvent)Database.SaveResult

Publishes a single platform event record, using `EventBus.publish(SObject record);

####### Parameters

Param Description
platformEvent The platform event record to publish

####### Return

Type

Database.SaveResult

Description

The instance of Database.SaveResult, generated by the platform when publishing the platform event record

publishRecords(List<SObject> platformEvents)List<Database.SaveResult>

Publishes a list of platform event records, using EventBus.publish(List&lt;SObject&gt; records)

####### Parameters

Param Description
platformEvents The list of platform event records to publish

####### Return

Type

List<Database.SaveResult>

Description

The instance of List&lt;Database.SaveResult&gt;, generated by the platform when publishing the platform event records

publishRecords(List<SObject> platformEvents, Database.DmlOptions dmlOptions)List<Database.SaveResult>

Publishes a list of platform event records, using EventBus.publish(List&lt;SObject&gt; records). The provided instance of Database.DmlOptions is used to control truncating of string fields before publishing the records.

####### Parameters

Param Description
platformEvents The list of platform event records to publish
dmlOptions An instance of Database.DmlOptions, used to control truncating of string fields

####### Return

Type

List<Database.SaveResult>

Description

The instance of List&lt;Database.SaveResult&gt;, generated by the platform when publishing the platform event records


LoggerDataStore.JobQueue class

Class used to centralize the handling of enqueueing any queueable jobs


Methods
enqueueJob(Queueable queueableJob)Id

Enqueues a queueable job to execute asynchronously, using System.enqueueJob(Queueable queueableJob)

####### Parameters

Param Description
queueableJob An instance of a Queueable class that should be enqueued

####### Return

Type

Id

Description

The Id of the queueable job