diff --git a/nebula-logger/core/main/configuration/objects/LogScenarioRule__mdt/fields/NumberOfDaysToRetainLogs__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LogScenarioRule__mdt/fields/NumberOfDaysToRetainLogs__c.field-meta.xml index 8ace31da7..85793dcec 100644 --- a/nebula-logger/core/main/configuration/objects/LogScenarioRule__mdt/fields/NumberOfDaysToRetainLogs__c.field-meta.xml +++ b/nebula-logger/core/main/configuration/objects/LogScenarioRule__mdt/fields/NumberOfDaysToRetainLogs__c.field-meta.xml @@ -4,7 +4,7 @@ false SubscriberControlled This value is used to set the field Log__c.LogRetentionDate__c, which is then used by LogBatchPurger to delete old logs. To keep logs indefinitely, set this field to blank (null). + >This value is used to set the field Log__c.LogRetentionDate__c, which is then used by LogBatchPurger to delete old logs. To keep logs indefinitely, set this field to a blank value (null). 4 false diff --git a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/DefaultLogShareAccessLevel__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/DefaultLogShareAccessLevel__c.field-meta.xml index 94efb19a4..1e0232424 100644 --- a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/DefaultLogShareAccessLevel__c.field-meta.xml +++ b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/DefaultLogShareAccessLevel__c.field-meta.xml @@ -4,19 +4,10 @@ 'Read' Uses Apex managed sharing to grants users read or edit access to their log records (on insert only). When no access level is specified, no Apex sharing logic is executed. This only gives record-level access - users will still need to be granted access to the Log__c object using permission sets or profiles. - -Possible Values: -(blank) -Read -Edit + false Uses Apex managed sharing to grants users read or edit access to their log records (on insert only). When no access level is specified, no Apex sharing logic is executed. This only gives record-level access - users will still need to be granted access to the Log__c object using permission sets or profiles. - -Possible Values: -(blank) -Read -Edit + >Uses Apex managed sharing to grants users read or edit access to their log records (on insert only). When no access level is specified, no Apex sharing logic is executed. This only gives record-level access - users will still need to be granted access to the Log__c object using permission sets or profiles. 255 false diff --git a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/DefaultSaveMethod__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/DefaultSaveMethod__c.field-meta.xml index b61108bf7..e6e97b71f 100644 --- a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/DefaultSaveMethod__c.field-meta.xml +++ b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/DefaultSaveMethod__c.field-meta.xml @@ -2,21 +2,11 @@ DefaultSaveMethod__c 'EVENT_BUS' - Defaults to 'EVENT_BUS'. This controls the default save method used by Logger when calling saveLog(). - -Possible values: -EVENT_BUS -QUEUEABLE -REST -SYNCHRONOUS_DML + Defaults to EVENT_BUS. This controls the default save method used by Logger when calling saveLog(). In most situations, EVENT_BUS should be used. false - Defaults to 'EVENT_BUS'. This controls the default save method used by Logger when calling saveLog(). - -Possible values: -EVENT_BUS -QUEUEABLE -REST -SYNCHRONOUS_DML + Defaults to EVENT_BUS. This controls the default save method used by Logger when calling saveLog(). In most situations, EVENT_BUS should be used. 255 true diff --git a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/IsAnonymousModeEnabled__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/IsAnonymousModeEnabled__c.field-meta.xml index cd340c178..b547ba2aa 100644 --- a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/IsAnonymousModeEnabled__c.field-meta.xml +++ b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/IsAnonymousModeEnabled__c.field-meta.xml @@ -3,9 +3,8 @@ IsAnonymousModeEnabled__c false false - When enabled, any logs generated will not have any user-specific details set - any fields related to the User, Profile, etc. will be null. - -Note: this feature only works properly when using the save method EVENT_BUS. + When enabled, any logs generated will not have any user-specific details set - any fields related to the User, Profile, etc. will be null. Note: this feature only works properly when using the save method EVENT_BUS. false Checkbox diff --git a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/IsPlatformEventStorageEnabled__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/IsPlatformEventStorageEnabled__c.field-meta.xml new file mode 100644 index 000000000..ab0b46b87 --- /dev/null +++ b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/IsPlatformEventStorageEnabled__c.field-meta.xml @@ -0,0 +1,12 @@ + + + IsPlatformEventStorageEnabled__c + true + Controls if LogEntryEvent__e platform events are transformed & stored in the custom objects Log__c and LogEntry__c (when IsSavingEnabled__c == true). + false + Controls if LogEntryEvent__e platform events are transformed & stored in the custom objects Log__c and LogEntry__c (when IsSavingEnabled__c == true). + + Checkbox + diff --git a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/IsSavingEnabled__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/IsSavingEnabled__c.field-meta.xml new file mode 100644 index 000000000..4541d296d --- /dev/null +++ b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/IsSavingEnabled__c.field-meta.xml @@ -0,0 +1,10 @@ + + + IsSavingEnabled__c + true + Controls if saving is enabled - when disabled, any calls to saveLog() are ignored. + false + Controls if saving is enabled - when disabled, any calls to saveLog() are ignored. + + Checkbox + diff --git a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/LoggingLevel__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/LoggingLevel__c.field-meta.xml index 89a4a83e4..ef9103a68 100644 --- a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/LoggingLevel__c.field-meta.xml +++ b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/LoggingLevel__c.field-meta.xml @@ -3,14 +3,6 @@ LoggingLevel__c 'DEBUG' false - Possible values: -ERROR -WARN -INFO -DEBUG -FINE -FINER -FINEST 255 true diff --git a/nebula-logger/core/main/log-management/classes/LogEntryEventHandler.cls b/nebula-logger/core/main/log-management/classes/LogEntryEventHandler.cls index 3f76d2ef6..2a7448e2f 100644 --- a/nebula-logger/core/main/log-management/classes/LogEntryEventHandler.cls +++ b/nebula-logger/core/main/log-management/classes/LogEntryEventHandler.cls @@ -56,6 +56,13 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler { Log__c recentLogWithApiReleaseDetails = getRecentLogWithApiReleaseDetails(); for (LogEntryEvent__e logEntryEvent : this.logEntryEvents) { + // Load the logging user's settings + User loggingUser = new User(Id = logEntryEvent.LoggedById__c, ProfileId = logEntryEvent.ProfileId__c); + LoggerSettings__c loggingUserSettings = Logger.getUserSettings(loggingUser); + if (loggingUserSettings.IsPlatformEventStorageEnabled__c == false) { + continue; + } + // The LogEntryEvent__e object stores a denormalized version of Log__c & LogEntry__c data // In case the list contains entries tied to multiple transactions, use the TRANSACTION_ID_TO_LOG map to create 1 Log__c per transaction ID if (TRANSACTION_ID_TO_LOG.containsKey(logEntryEvent.TransactionId__c) == true) { @@ -141,6 +148,12 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler { private void insertLogEntries() { for (LogEntryEvent__e logEntryEvent : this.logEntryEvents) { + User loggingUser = new User(Id = logEntryEvent.LoggedById__c, ProfileId = logEntryEvent.ProfileId__c); + LoggerSettings__c loggingUserSettings = Logger.getUserSettings(loggingUser); + if (loggingUserSettings.IsPlatformEventStorageEnabled__c == false) { + continue; + } + // Workaround field for platform issue w/ accurate datetimes Datetime timestamp = String.isNotBlank(logEntryEvent.TimestampString__c) ? Datetime.valueOf(Long.valueOf(logEntryEvent.TimestampString__c)) diff --git a/nebula-logger/core/main/log-management/classes/LoggerSettingsController.cls b/nebula-logger/core/main/log-management/classes/LoggerSettingsController.cls index 2e55b9229..7c7fc8abf 100644 --- a/nebula-logger/core/main/log-management/classes/LoggerSettingsController.cls +++ b/nebula-logger/core/main/log-management/classes/LoggerSettingsController.cls @@ -256,30 +256,12 @@ public without sharing class LoggerSettingsController { } private static List queryLoggerSettings() { - return [ - SELECT - CreatedBy.Username, - CreatedById, - CreatedDate, - DefaultLogShareAccessLevel__c, - DefaultNumberOfDaysToRetainLogs__c, - DefaultSaveMethod__c, - Id, - IsAnonymousModeEnabled__c, - IsApexSystemDebugLoggingEnabled__c, - IsJavaScriptConsoleLoggingEnabled__c, - IsDataMaskingEnabled__c, - IsEnabled__c, - LastModifiedBy.Username, - LastModifiedById, - LastModifiedDate, - LoggingLevel__c, - SetupOwner.Name, - SetupOwner.Type, - SetupOwnerId, - StripInaccessibleRecordFields__c - FROM LoggerSettings__c - ]; + List fieldNames = new List(Schema.LoggerSettings__c.SObjectType.getDescribe().fields.getMap().keySet()); + fieldNames.add('CreatedBy.Username'); + fieldNames.add('LastModifiedBy.Username'); + fieldNames.add('SetupOwner.Name'); + fieldNames.add('SetupOwner.Type'); + return (List) Database.query('SELECT ' + String.join(fieldNames, ', ') + ' FROM ' + Schema.LoggerSettings__c.SObjectType); } private static Map querySetupOwnerNames(List setupOwnerIds) { diff --git a/nebula-logger/core/main/log-management/lwc/loggerSettings/__tests__/data/getObjectInfo.json b/nebula-logger/core/main/log-management/lwc/loggerSettings/__tests__/data/getObjectInfo.json index 864becc9d..a89dece27 100644 --- a/nebula-logger/core/main/log-management/lwc/loggerSettings/__tests__/data/getObjectInfo.json +++ b/nebula-logger/core/main/log-management/lwc/loggerSettings/__tests__/data/getObjectInfo.json @@ -269,7 +269,7 @@ "filteredLookupInfo": null, "highScaleNumber": false, "htmlFormatted": false, - "inlineHelpText": "This value is used to set the field Log__c.LogRetentionDate__c, which is then used by LogBatchPurger to delete old logs. To keep logs indefinitely, set this field to blank (null).", + "inlineHelpText": "This value is used to set the field Log__c.LogRetentionDate__c, which is then used by LogBatchPurger to delete old logs. To keep logs indefinitely, set this field to a blank value (null).", "label": "Days to Retain Logs", "length": 0, "nameField": false, diff --git a/nebula-logger/core/main/log-management/lwc/loggerSettings/loggerSettings.html b/nebula-logger/core/main/log-management/lwc/loggerSettings/loggerSettings.html index 1bc8e7b2c..1f2a62958 100644 --- a/nebula-logger/core/main/log-management/lwc/loggerSettings/loggerSettings.html +++ b/nebula-logger/core/main/log-management/lwc/loggerSettings/loggerSettings.html @@ -53,6 +53,7 @@

Logger Settings Details

+

General Settings @@ -217,183 +218,61 @@

- -
-

- Log Management Settings -

- - - - - - - - -
- - -
-

- Developer Settings -

- - - - - - - - - -
- - -
-

- Security Settings -

- - - - - - - - - -
- - -