Skip to content

Commit

Permalink
Big Object Plugin (#287)
Browse files Browse the repository at this point in the history
* Picking #117 back up with @jongpie to finally add BigObject support through Logger plugin package - includes a new BigObject LogEntryArchive__b and new plugin class

* Cleaned up some picklist values for LoggerPlugin__mdt.PluginType__c with an eye towards future BigObject changes

* Added an permission set LoggerLogEntryArchiveAdmin within BigObject plugin to grant access to the BigObject LogEntryArchive__b

* Switched to lazy-loading the instance of SObjectHandlerInput - tests were previously failing because of the input being generated too early by the trigger framework

* Added apex script with sample query for LogEntryArchive__b that includes filters on the indexed fields

* Added plugins folder to the script for generating apex doc files, generated updated docs for Apex

* Bumped package version number for the managed package

* Added 5 minute wait between unlocked package version creation & package installation, added deprecated LoggerPlugin__mdt validation rule & field back into the managed-package folder, cleaned up some docs markdown files

Co-authored-by: Jonathan Gillespie <[email protected]>
  • Loading branch information
jamessimone and jongpie authored Mar 17, 2022
1 parent fe39523 commit b3ebafc
Show file tree
Hide file tree
Showing 157 changed files with 2,862 additions and 65 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Designed for Salesforce admins, developers & architects. A robust logger for Ape

## Unlocked Package - v4.7.1

[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lXSQAY)
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lXSQAY)
[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lYaQAI)
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lYaQAI)
[![View Documentation](./images/btn-view-documentation.png)](https://jongpie.github.io/NebulaLogger/)

## Managed Package - v4.7.0
Expand Down
20 changes: 20 additions & 0 deletions docs/apex/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ Provides the ability to generate string messages on demand, using String.format(

The core class for logging

## Miscellaneous

### [FailureCalloutMock](/Miscellaneous/FailureCalloutMock)

Inner class for handling mock HTTP callouts that should end in errors / exceptions.

## Log Management

### [LogBatchPurgeScheduler](log-management/LogBatchPurgeScheduler)
Expand Down Expand Up @@ -96,6 +102,20 @@ Handles trigger events for the `LoggerTag__c` object

Controller class for the lightning web component `related-log-entries`

## Plugins

### [LogEntryArchiveBuilder](plugins/LogEntryArchiveBuilder)

Optional plugin that provides a BigObject, `LogEntryArchive__b`, as an alternative option to the platform event `LogEntryEvent__e`

### [LogRetentionRulesPlugin](plugins/LogRetentionRulesPlugin)

Optional plugin that adds the ability to create &amp; deploy advanced, configurable rules for setting the retention date of `Log__c` records, using custom metadata types `LogRetentionRule_t` and `LogRetentionRuleCondition_t`.

### [SlackLoggerPlugin](plugins/SlackLoggerPlugin)

Optional plugin that integrates with Slack to send alerts for important logs

## Configuration

### [LoggerEmailUtils](configuration/LoggerEmailUtils)
Expand Down
33 changes: 33 additions & 0 deletions docs/apex/log-management/LogEntryEventHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ Processes `LogEntryEvent__e` platform events and normalizes the data into `Log__

---

### Constructors

#### `LogEntryEventHandler()`

Default constructor, used by the trigger `LogEntryEvent.trigger`

#### `LogEntryEventHandler(TriggerOperation triggerOperationType, List<LogEntryEvent__e> logEntryEvents)`

Additional constructor specific to `LogEntryEvent__e`, used in `Logger` to simulate a `BEFORE_INSERT` context

##### Parameters

| Param | Description |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `triggerOperationType` | The instance of `TriggerOperation` that the handler class should use - this overrides the `TriggerOperation` provided by `LoggerSObjectHandler` |
| `logEntryEvents` | The list of `LogEntryEvent__e` records in Logger&apos;s buffer |

---

### Properties

#### `releaseNumber``String`
Expand Down Expand Up @@ -70,6 +89,20 @@ Schema.SObjectField

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getHandlerPluginSortField()``Schema.SObjectField`

Returns the `SObjectField` on `LoggerPlugin_t` that controls the sorting of plugins for the handler&apos;s `SObjectType`

##### Return

**Type**

Schema.SObjectField

**Description**

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getSObjectType()``SObjectType`

Returns SObject Type that the handler is responsible for processing
Expand Down
14 changes: 14 additions & 0 deletions docs/apex/log-management/LogEntryHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ Schema.SObjectField

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getHandlerPluginSortField()``Schema.SObjectField`

Returns the `SObjectField` on `LoggerPlugin_t` that controls the sorting of plugins for the handler&apos;s `SObjectType`

##### Return

**Type**

Schema.SObjectField

**Description**

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getSObjectType()``SObjectType`

Returns SObject Type that the handler is responsible for processing
Expand Down
14 changes: 14 additions & 0 deletions docs/apex/log-management/LogEntryTagHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ Schema.SObjectField

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getHandlerPluginSortField()``Schema.SObjectField`

Returns the `SObjectField` on `LoggerPlugin_t` that controls the sorting of plugins for the handler&apos;s `SObjectType`

##### Return

**Type**

Schema.SObjectField

**Description**

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getSObjectType()``SObjectType`

Returns SObject Type that the handler is responsible for processing
Expand Down
14 changes: 14 additions & 0 deletions docs/apex/log-management/LogHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ Schema.SObjectField

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getHandlerPluginSortField()``Schema.SObjectField`

Returns the `SObjectField` on `LoggerPlugin_t` that controls the sorting of plugins for the handler&apos;s `SObjectType`

##### Return

**Type**

Schema.SObjectField

**Description**

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getSObjectType()``SObjectType`

Returns SObject Type that the handler is responsible for processing
Expand Down
16 changes: 14 additions & 2 deletions docs/apex/log-management/LoggerSObjectHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ Schema.SObjectField

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getHandlerPluginSortField()``Schema.SObjectField`

Returns the `SObjectField` on `LoggerPlugin_t` that controls the sorting of plugins for the handler&apos;s `SObjectType`

##### Return

**Type**

Schema.SObjectField

**Description**

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getSObjectType()``Schema.SObjectType`

Returns the SObject Type that the handler is responsible for processing
Expand Down Expand Up @@ -82,8 +96,6 @@ Class used by the logging system to for trigger context details

###### `triggerNewMap``Map<Id, SObject>`

###### `triggerOld``List<SObject>`

###### `triggerOldMap``Map<Id, SObject>`

###### `triggerOperationType``TriggerOperation`
Expand Down
14 changes: 14 additions & 0 deletions docs/apex/log-management/LoggerTagHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ Schema.SObjectField

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getHandlerPluginSortField()``Schema.SObjectField`

Returns the `SObjectField` on `LoggerPlugin_t` that controls the sorting of plugins for the handler&apos;s `SObjectType`

##### Return

**Type**

Schema.SObjectField

**Description**

The instance of `Schema.SObjectField` on `LoggerPlugin_t` for the current `SObjectType`

#### `getSObjectType()``SObjectType`

Returns SObject Type that the handler is responsible for processing
Expand Down
10 changes: 10 additions & 0 deletions docs/apex/logger-engine/Logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -4228,6 +4228,16 @@ Saves any entries in Logger&apos;s buffer, using the specified save method for o
| ------------ | ------------------------------------------------------------------------- |
| `saveMethod` | The enum value of Logger.SaveMethod to use for this specific save action. |

#### `saveLog(String saveMethodName)``void`

Saves any entries in Logger&apos;s buffer, using the specified save method for only this call. All subsequent calls to saveLog() will use the transaction save method.

##### Parameters

| Param | Description |
| ---------------- | ------------------------------------------------------------------------- |
| `saveMethodName` | The String value of the save method to use for this specific save action. |

#### `setParentLogTransactionId(String parentTransactionId)``void`

Relates the current transaction&apos;s log to a parent log via the field Log**c.ParentLog**c This is useful for relating multiple asynchronous operations together, such as batch &amp; queueable jobs.
Expand Down
4 changes: 2 additions & 2 deletions docs/apex/plugin-framework/LoggerSObjectHandlerPlugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ This method is the entry point for plugins to execute any custom logic. It is au

| Param | Description |
| --------------- | ------------------------------------------------------------------------------------------------ |
| `input` | The instance of `LoggerSObjectHandlerPlugin.SObjectHandlerInput`, provided by the logging system |
| `configuration` | The instance of `LoggerPlugin_t` configured for this specific plugin |
| `input` | The instance of `LoggerSObjectHandlerPlugin.SObjectHandlerInput`, provided by the logging system |

#### `execute(TriggerOperation triggerOperationType,List<SObject> triggerNew,Map<Id, SObject> triggerNewMap,List<SObject> triggerOld,Map<Id, SObject> triggerOldMap)``void`

@deprecated Deprecated, will be removed: This method is the entry point for plugins to execute any custom logic. It is automatically called by the logging system for any enabled plugins. Several trigger-based parameters are provided - these parameters should be used by plugins, instead of calling the platform&apos;s static variables directly (e.g., use the provided `triggerNew` variable instead of using `Trigger.new` directly, and so on).
Deprecated, will be removed: This method is the entry point for plugins to execute any custom logic. It is automatically called by the logging system for any enabled plugins. Several trigger-based parameters are provided - these parameters should be used by plugins, instead of calling the platform&apos;s static variables directly (e.g., use the provided `triggerNew` variable instead of using `Trigger.new` directly, and so on).

##### Parameters

Expand Down
24 changes: 24 additions & 0 deletions docs/apex/plugins/LogEntryArchiveBuilder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
layout: default
---

## LogEntryArchiveBuilder class

Optional plugin that provides a BigObject, `LogEntryArchive__b`, as an alternative option to the platform event `LogEntryEvent__e`

---

### Methods

#### `execute(LoggerPlugin_t configuration, LoggerSObjectHandler.SObjectHandlerInput input)``void`

Handles converting Logger&apos;s buffer of `LogEntryEvent__e` records into `LogEntryArchive__b` records for any user with the included custom save method &apos;BIG_OBJECT&apos;

##### Parameters

| Param | Description |
| --------------- | ------------------------------------------------------------------------------------------------ |
| `configuration` | The instance of `LoggerPlugin_t` configured for this specific plugin |
| `input` | The instance of `LoggerSObjectHandlerPlugin.SObjectHandlerInput`, provided by the logging system |

---
54 changes: 54 additions & 0 deletions docs/apex/plugins/LogRetentionRulesPlugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
layout: default
---

## LogRetentionRulesPlugin class

Optional plugin that adds the ability to create &amp; deploy advanced, configurable rules for setting the retention date of `Log__c` records, using custom metadata types `LogRetentionRule_t` and `LogRetentionRuleCondition_t`.

---

### Properties

#### `conditions``List<String>`

#### `conditionsLogic``String`

#### `conditionsLogicType``String`

#### `matchesFilter``Boolean`

#### `record``SObject`

#### `rule``LogRetentionRule_t`

---

### Methods

#### `FieldPath(Schema.SObjectType sobjectType, String fieldPath)``public`

#### `FilterResult(SObject record, LogRetentionRule_t rule, List<LogRetentionRuleCondition_t> filterConditions)``public`

#### `evaluate(String x)``Boolean`

#### `execute(LoggerPlugin_t configuration, LoggerSObjectHandler.SObjectHandlerInput input)``void`

Handles converting Logger&apos;s buffer of `LogEntryEvent__e` records into `LogEntryArchive__b` records for any user with the included custom save method &apos;BIG_OBJECT&apos;

##### Parameters

| Param | Description |
| --------------- | ------------------------------------------------------------------------------------------------ |
| `configuration` | The instance of `LoggerPlugin_t` configured for this specific plugin |
| `input` | The instance of `LoggerSObjectHandlerPlugin.SObjectHandlerInput`, provided by the logging system |

#### `getCondition()``String`

#### `getField()``Schema.SObjectField`

#### `getValue(SObject record)``Object`

#### `matchesFilter()``Boolean`

---
Loading

2 comments on commit b3ebafc

@jamessimone
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you again for bringing this one home! Really excited to see this used as a plugin — what a journey since we first worked on this together!

@jongpie
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all of your help!! It's definitely been a journey getting to this point, and I love how it's coming together 🥳

Please sign in to comment.