Skip to content

Tagging System Overhaul

Compare
Choose a tag to compare
@jongpie jongpie released this 10 Aug 00:07
· 133 commits to main since this release
9a01220

Added new tagging objects & more robust tagging functionality

  • 2 "tagging modes" are now built into Nebula Logger
    1. Using Salesforce Topics: this old functionality is still available in the unlocked package (but still not available in the managed package. However, as of release v4.6.0, it will no longer be the default. After upgrading to v4.6.0, you can revert to using Topics by updating the custom metadata record "LogEntryEventHandler - Use Topics for Tags" within the CMDT object LoggerSObjectHandlerParameter__mdt - simply change the Value__c field from false to true and save.
    2. Using Logger's Custom Tagging objects: available in both the unlocked package and managed package, this mode will be the default as of release v4.6.0. This mode uses 2 additional custom objects, LoggerTag__c and LogEntryTag__c in place of Topic and TopicAssignment (respectively)
  • Tags can be added in 3 different ways
    1. In Apex: developers can use 2 new methods in LogEntryBuilder to add tags
      // Use addTag(String tagName) for adding 1 tag at a time
      Logger.debug('my log message').addTag('some tag').addTag('another tag');
      
      // Use addTags(List<String> tagNames) for adding a list of tags in 1 method call
      List<String> myTags = new List<String>{'some tag', 'another tag'};
      Logger.debug('my log message').addTags(myTags);
    2. In Flow: flow builders can set the property List<String> tags within the Flow classes FlowLogEntry, FlowRecordLogEntry and FlowCollectionLogEntry
    3. Using the custom metadata type object LogEntryTagRule__mdt: admins can configure tagging rules to append additional tags. These tags are added on top of any tags added via Apex and/or Flow. Rules can be set up by configuring a rule with these fields set:
      1. Logger SObject: currently, only the "Log Entry" object (LogEntry__c) is supported.
      2. Field: the SObject's field that should be evaluated - for example, LogEntry__c.Message__c. Only 1 field can be selected per rule, but multiple rules can use the same field.
      3. Comparison Type: the type of operation you want to use to compare the field's value. Currently supported options are: CONTAINS, EQUALS, MATCHES_REGEX, and STARTS_WITH
      4. Comparison Value: the comparison value that should be used for the selected field operation
      5. Tags: a list of tag names that should be dynamically applied to any matching LogEntry__c records. When specifying multiple tags, put each tag on a separate line within the Tags field
      6. Is Enabled: only enabled rules are used by Logger - this is a handy way to easily enable/disable a particular rule without having to entirely delete it