Skip to content

Releases: jongpie/NebulaLogger

Custom Field Mappings Support

12 Jul 18:31
2dbbf9f
Compare
Choose a tag to compare

Thanks to @pankaj0509 and @codejester90 for suggesting this enhancement & providing some great feedback!

Core Unlocked Package Changes

This release resolves #655 by adding support for defining, setting, and mapping custom fields within Nebula Logger's data model. This is helpful in orgs that want to extend Nebula Logger's included data model by creating their own org/project-specific fields.

Adding custom fields to the platform event LogEntryEvent__e

To get started, the first step is to add a field to the platform LogEntryEvent__e`

  • Create your own custom fields on LogEntryEvent__e. Any data type supported by platform events can be used.

    • In this example, a custom text field called SomeCustomField__c has been added:

      image

  • Populate your own custom fields in Apex by calling one of the two new instance methods on LogEntryEventBuilder:

    1. setField(Schema.SObjectField field, Object fieldValue)
    2. setField(Map<Schema.SObjectField, Object> fieldToValue)

For now, this functionality is available in Apex. Long-term, equivalent functionality will hopefully be added for Flow & Lightning Components. Here is an example of using the 2 new methods in Apex:

Logger.info('hello, world')
    // Set a single field
    .setField(LogEntryEvent__e.SomeCustomTextField__c, 'some text value')
    // Set multiple fields
    .setField(new Map<Schema.SObjectField, Object>{
        LogEntryEvent__e.AnotherCustomTextField__c => 'another text value',
        LogEntryEvent__e.SomeCustomDatetimeField__c => System.now()
    });

Adding custom fields to the custom objects Log__c, LogEntry__c, and LoggerScenario__c

If you want to store the data in one of Nebula Logger's custom objects, you can follow the above steps, and also...

  • Create an equivalent custom field on one of Nebula Logger's custom objects - right now, only Log__c, LogEntry__c, and LoggerScenario__c are supported.

  • In this example, a custom text field also called SomeCustomField__c has been added to Log__c object - this will be used to store the value of the field LogEntryEvent__e.SomeCustomField__c:

    image

  • Create a record in the new CMDT LoggerFieldMapping__mdt to map the LogEntryEvent__e custom field to the custom object's custom field, shown below. Nebula Logger will automatically populate the custom object's target field with the value of the source LogEntryEvent__e field.

    • In this example, a custom text field called SomeCustomField__c has been added to both LogEntryEvent__e and Log__c.

      image

New extra-tests Metadata

To help with testing Nebula Logger, a few new metadata items have been added to the extra-tests directory. This directory is not included in any of Nebula Logger's packages - its metadata is used to help both with automated tests in the pipeline, as well as manual functional tests.

  • Added some new custom fields for the objects LogEntryEvent__e, Log__c, LogEntry__c, and LoggerScenario__c to the extra-tests directory to provide sample fields that are only used for testing the custom field mapping functionality
  • Added some new CMDT records for the new object LoggerFieldMapping__mdt. These records map the (new) included custom fields (mentioned above)

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.13.13...v4.13.14

Improved Fully-Qualified References

11 Jul 17:03
48ea5fe
Compare
Choose a tag to compare

Since the unlocked package does not have a namespace, orgs can encounter installation errors for Nebula Logger if the target org has any custom Apex code (classes, enums, interfaces, etc.) with the same name as standard class in the Schema or System namespace (referred to as name shadowing).

This is the same concept & approach as the changes made in several previous releases (listed below) - but my hope is that this PR finally finishes this effort, and all references are now fully qualified.

This shouldn't cause any functional changes to Nebula Logger - this is to tidy up existing references to avoid name collisions so that more orgs can use the unlocked package.

Core Unlocked Package Changes

Apex Code Changes

  • Switched to using fully-qualified references for these standard classes in the Schema and System namespaces :

    • Schema namespace standard classes
      • ApexClassSchema.ApexClass
      • ApexEmailNotificationSchema.ApexEmailNotification
      • ApexTriggerSchema.ApexTrigger
      • AsyncApexJobSchema.AsyncApexJob
      • BatchApexErrorEventSchema.BatchApexErrorEvent
      • CustomPermissionSchema.CustomPermission
      • DisplayTypeSchema.DisplayType
      • FlowDefinitionViewSchema.FlowDefinitionView
      • FlowExecutionErrorEventSchema.FlowExecutionErrorEvent
      • FlowVersionViewSchema.FlowVersionView
      • PermissionSetSchema.PermissionSet
      • PermissionSetAssignmentSchema.PermissionSetAssignment
      • SoapTypeSchema.SoapType
      • UserRecordAccessSchema.UserRecordAccess
      • UserRoleSchema.UserRole
    • System namespace standard classes
      • BatchableContextSystem.BatchableContext
      • ComparableSystem.Comparable
      • DatabaseSystem.Database
      • EventBusSystem.EventBus
      • FinalizerContextSystem.FinalizerContext
      • InstallHandlerSystem.InstallHandler
      • JSONSystem.JSON
      • MatcherSystem.Matcher
      • PatternSystem.Pattern
      • PicklistEntrySystem.PicklistEntry
      • QueueableSystem.Queueable
      • QueueableContextSystem.QueueableContext
      • QuidditySystem.Quiddity
      • RequestSystem.Request
      • RestContextSystem.RestContext
      • RestRequestSystem.RestRequest
      • RestResponseSystem.RestResponse
      • SchedulableSystem.Schedulable
      • SchedulableContextSystem.SchedulableContext
      • SearchSystem.Search
      • TriggerOperationSystem.TriggerOperation
      • UUIDSystem.UUID
  • Scope creep: fixed some flaky tests in LogBatchPurgeController_Tests

extra-tests Metadata Changes

  • Moved the existing name-shadowing classes in the extra-tests directory to be in separate subdirectories (one for each namespace, Schema and System)
  • Added several new name-shadowing classes for all of the Schema & System references (mentioned above) that are now using fully-qualified references
    • These classes are deployed in Nebula Logger's pipeline to enforce that the codebase uses fully-qualified references

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.13.12...v4.13.13

Added refresh button + spinner on relatedLogEntries LWC

07 Jul 18:51
88c630b
Compare
Choose a tag to compare

Thanks to @andrii-solokh for implementing this enhancement! (PR #703)

Core Unlocked Package Changes

  • Added new refresh button on the LWC relatedLogEntries. This makes it easy to refresh just the list of LogEntry__c records, without having to refresh the entire page

    • When refreshing the data, a lightning-spinner is now overlayed on the LWC

    image

New extra-tests Metadata

  • Added sample flexipage Nebula_Logger_Account_Record_Page that's used as the org default for the Account object when deploying Nebula Logger's extra-tests folder - this makes it easy to test the LWC relatedLogEntries in a scratch org

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.13.11...v4.13.12

Added tracking of logging user's federation identifier

29 Apr 16:52
4d56ecb
Compare
Choose a tag to compare

Core Unlocked Package Changes

This release adds new fields & automation to track the logging user's federation identifier - this field is used in SAML SSO (Single Sign-On) settings, and is often a person's unique identifier in multiple systems. By capturing it in Nebula Logger, it makes it easier for Salesforce logs to be tied to logs for the same user in other systems.

  • Added new long textarea (512) fields LoggedByFederationIdentifier__c on LogEntryEvent__e and Log__c to track the value of Schema.User.FederationIdentifier for the logging user

  • Added new field Log__c.HasLoggedByFederationIdentifier__c to make it easier to filter/identify records where the user's federation ID has been populated

  • Added field-level security (FLS) for the new Log__c fields to the permission sets LoggerAdmin, LoggerLogViewer, and LoggerEndUser

  • Added new field Log__c.LoggedByFederationIdentifier__c to the flexipage LogRecordPage - it conditionally shows, based on the value of the other new field, Log__c.HasLoggedByFederationIdentifier__c

    image

Big Object Archive Plugin Changes

  • Renamed the Big Object index LogEntryArchiveIndex.indexe-meta.xml to LogEntryArchiveIndex.index-meta.xml (indexe --> index) to fix an issue with newer versions of the sf cli
    • This doesn't impact any functionality in the plugin, so there is not a new release for the plugin - just a small change to the metadata in the repo

Pipeline Changes

  • Deleted several old scripts in package.json and in the directory ./scripts/build
  • Upgraded package dependencies & regenerated package-lock.json
  • Tweaked config in .prettierrc
  • Updated GitHub Actions in build.yml to use v4 (compatible with Node 20)

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.13.10...v4.13.11

AuthSession Bugfix for LWC Logging

24 Apr 01:50
18b4b52
Compare
Choose a tag to compare

Thanks to @Suryansh-2301 for reporting this bug!

Core Unlocked Package Changes

  • Fixed #678 by removing the filter ParentId = null when querying AuthSession data in LoggerEngineDataSelector
  • Added a small enhancement to store the ParentId of the AuthSession record in the new fields LogEntryEvent__e.ParentSessionId__c and Log__c.ParentSessionId__c
    • Updated permission sets LoggerAdmin, LoggerLogViewer, and LoggerEndUser to provide read access to the new field Log__c.ParentSessionId__c

    • Updated FlexiPage LogRecordPage to conditionally display the new field Log__c.ParentSessionId__c when it's populated

      image

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.13.9...v4.13.10

Updated Logging Level Emojis

18 Apr 02:59
fcb3b43
Compare
Choose a tag to compare

Thanks to @twentyTwo for suggesting & implementing these changes, and thanks to @PawelWozniak for the feedback!

Core Unlocked Package Changes

  • Closed #665 in PR #672 by updating the formula field LogEntry__c.LoggingLevelWithImage__c to use different emojis for every logging level to make it easier to visually distinguish between them. Previously, the same emoji was used for DEBUG, FINE, FINER, and FINEST. The new list of emojis used are:
    • ERROR => ⛔
    • WARN => ⚠️
    • DEBUG => 🐞
    • INFO => ℹ️
    • FINE => 👍
    • FINER => 👌
    • FINEST => 🌟

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.13.8...v4.13.9

Fixed logEntryMetadataViewer LWC's 'View Full Source' button not showing for non-admins

18 Apr 01:33
de8088d
Compare
Choose a tag to compare

Core Unlocked Package Changes

  • Worked with @jamessimone to troubleshoot & fix some additional issues in the logEntryMetadataViewer LWC that prevented the 'View Full Source' button from showing up for non-admins. This involved 3 related changes

    1. Added ApexClass access in the permission sets LoggerAdmin, LoggerLogViewer, LoggerEndUser for the Apex class LogEntryMetdataViewerController to fix some permission errors that could occur in some orgs/situations.
    2. Fixed some excessively large whitespace in the LWC caused by a present-but-not-visible spinner.
    3. Updated the logEntryMetadataViewer LWC to imperatively call Apex controller methods - using the @wire annotation caused weird, silent failures when calling the Apex methods, but calling it imperatively seems to work wonderfully (and is more consistent with how the other LWCs in Nebula Logger are written).

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.13.7...v4.13.8

Fixed setScenario() function in logger LWC

17 Apr 00:49
f4addfd
Compare
Choose a tag to compare

Thanks to @rcastanosgonzalez for reporting and fixing this bug!

Core Unlocked Package Changes

  • Fixed #666 issue in PR #667 by updating the logger LWC's function setScenario() to properly (and always) set the scenario on each log entry. Previously, the value was often incorrectly set to null

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.13.6...v4.13.7

View Log Entry Metadata custom permission

02 Apr 15:23
8233697
Compare
Choose a tag to compare

Core Unlocked Package Changes

  • Added new custom permission CanViewLogEntryMetadata so that users without query access to ApexClass and ApexTrigger can still see the source code in the LWC logEntryMetadataViewer
  • Updated the permission set LoggerAdmin to assign the new custom permission CanViewLogEntryMetadata
  • Added some more test methods in LogEntryMetadataViewerController_Tests, and cleaned up some code in LogEntryMetadataViewerController

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.13.5...v4.13.6

Performance Improvements

29 Mar 16:39
6453b17
Compare
Choose a tag to compare

Change Overview

Emoji legend: 🟢 new, 🗜internal change, ⚠something to be aware of

  • 🟢 Adds new Logger Parameter CMDT record, Store Heap Size Limit, which relies on the Store Transaction Limits Logger Parameter record to also be true. When set to true, the LogEntry__c.LimitsHeapSizeUsed__c field is set. When set to false, that particular field is not set, and users of Nebula Logger performing bulk data uploads or other bulk data transactions where logging exists at an individual record level may well want to toggle this parameter to false, as it's the single greatest contributor to CPU speed slowdown when logging.
  • 🗜 Centralizes where field truncation is occurring for long text area fields so that less CPU time is spent looping through all of Schema.LogEntryEvent__e prior to publishing platform events
  • 🗜 Caches the System.Limits calls that are static for each transaction
  • 🗜 Simplifies stack trace parsing so that less CPU time is spent suppressing Nebula Logger classes when parsing
  • 🗜 Eliminates duplicated calls to LogEntryEventBuilder.getLogEntryEvent()
  • 🗜 Centralizes how database results are logged within Nebula to enable consistent field truncation for any potential errors
  • 🗜 Logger class now delegates to LogEntryEventBuilder instead of setting fields on Schema.LogEntryEvent__e directly
  • ⚠ Changes how the LogEntry__c.DatabaseResultJson__c stores results: if you were passing a list of results with only one entry in it, that is now recorded as a single entry instead of a single entry in a list
  • ⚠ Changes how Schema.LogEntryEvent__e.TimestampString__c is set - previously, consumers could rewrite a Schema.LogEntryEvent__e.Timestamp__c by calling LogEntryEventBuilder.getLogEntryEvent() and resetting that field. Now, Schema.LogEntryEvent__e.TimestampString__c is only set once when a LogEntryEventBuilder instance is first configured and downstream consumers can call the instance method LogEntryEventBuilder.setTimestamp(Datetime timestamp); if they'd like to override the timestamp later on

All of these changes amount to a substantial performance increase, and performance can be monitored using the new LoggerBenchmarking_Tests class

Benchmarking Stats

Here are some stats associated with this change when logging for 500 records (all times reported in milliseconds):

Branch LoggerBenchmarking_Tests overall LogEntryEventBuilder.getLogEntryEvent() LogEntryEventBuilder() constructor LoggerStackTrace.getCleansedStackTraceLines()
main 16405 1554 4697 1278
main 18178 1690 6309 1360
benchmarking-logger 10377 4511 64 206
benchmarking-logger 10416 4648 67 219

Additionally, LoggerDataStore.EventBus.TruncateStringFields was taking anywhere from ~2130ms to ~2590ms to run in #651 and that method has been eliminated entirely.

Installation Info

Core Unlocked Package - no namespace

Full Changelog: v4.13.4...v4.13.5