Skip to content

Custom metadata type optimizations

Compare
Choose a tag to compare
@jongpie jongpie released this 30 Sep 00:42
· 119 commits to main since this release
05c4c78

⚠️ For orgs that are upgrading to this version: you may need to review & update your org's configurations - this release includes several changes to the LoggerSettings__c custom hierarchy settings, and several old custom metadata types have been consolidated into a new custom metadata type LoggerParameter__mdt.

Custom metadata type (CMDT) optimizations

  • Created LoggerParameter__mdt to consolidate/replace several old custom metadata types. This new CMDT uses key-value pair approach for any system-wide configurations, and can be used by plugins for storing any plugin-specific configurations. These old custom metadata types will no longer be used going forward
    • LoggerSObjectHandler__mdt
    • LoggerSObjectHandlerParameter__mdt
    • LoggerSObjectHandlerPluginParameter__mdt
  • Renamed LoggerSObjectHandlerPlugin__mdt custom metadata type to LoggerPlugin__mdt
  • Fixed #210 reported by @arbokrad - Deprecated LoggerSettings__c.SystemLogMessageFormat__c, replaced it with CMDT-driven LoggerParameter.SYSTEM_DEBUG_MESSAGE_FORMAT
  • Deprecated LoggerSettings__c.EnableSystemMessages__c, replaced it with CMDT-driven constant LoggerParameter.ENABLE_LOGGER_SYSTEM_MESSAGES
  • Removed method overloads in LoggerParameter - all data type-based methods now require a defaultValue to be passed. This ensures that everything still works, even if the corresponding CMDT is missing/deleted in an org.

The old, deprecated custom metadata types

image

The new LoggerParameter__mdt custom metadata type records

image

Other included changes:

  • Fixed another issue reported by @arbokrad where LogEntryEventBuilder.setMessage() should be called last in some Logger static methods so that additional fields can be used when calling System.debug()
  • Fixed #213 reported by @vr8hub and some other scenarios related to logging SObject and List<SObject>
    1. Fixed - Logging failed when logging a record collection (List<SObject>) where the first record was null
    2. Fixed - Logging failed when logging an empty record collection
    3. Improved - Logging "worked" when logging a null record or null record collection, but there was no clear indication on the LogEntry__c record that you had even tried to log a record/record collection. Now, it will log the word "null" in the field RecordJson__c, and "Unknown" in the fields RecordSObjectClassification__c and RecordSObjectType__c
    4. Fixed - Data masking rules were not being applied to record collections (List<SObject>). Previously, data masking was only being applied when logging a single SObject record
  • PR #215 - thanks to @dancinllama for improving both the code quality AND code documentation by fixing several PMD rule violations, including adding missing JavaDoc/JavaDoc parameters 🥇 . The new & updated JavaDoc comments have also been incorporated into the Apex Documentation site
  • Deprecated Log__c.OrganizationInstanceReleaseCycle__c field - since there's no automatic way to determine it, it requires updates every release, and it doesn't seem worth maintaining it at this time
  • Deleted test classes that had accidentally been duplicated in a previous release
  • Switched to using lint-staged.config.js for more control over pre-commit hook scripts - thanks to @jamessimone for figuring this out!

Many thanks to @arbokrad, @vr8hub, @dancinllama, and @jamessimone for all of the amazing help this release!! 🥳