Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for logging Map<Id, SObject> in core, added support for configurable fields in Slack plugin #452

Merged
merged 25 commits into from
Mar 15, 2023

Conversation

jongpie
Copy link
Owner

@jongpie jongpie commented Feb 13, 2023

Core Package Changes

Apex Logging Improvements

  • Added new instance method overload LogEntryEventBuilder.setRecord(Map<Id, SObject> recordIdToRecord)
    • For now, I've decided to not add overloads for this in Logger directly - I might in a future release, but for now, setRecord() can be called by chaining the method to one of Logger's methods, like Logger.info('some message').setRecord(recordIdToRecord)
  • Updated System.debug() calls in Logger to start with 'Nebula Logger' instead of just 'Logger' for clarity

Admin Improvements

  • Updated formula field LogEntry__c.LoggingLevelWithImage__c to use a different emoji for INFO (✅) vs lower levels (⚙️ for DEBUG, FINE, FINER, and FINEST)
  • Added inline help text to all of the limits-related formula fields on LogEntry__c to describe the thresholds used to determine which emojis are shown in the formulas (⛔ ⚠️ ✅)
  • Unlocked package-only: Added AnimationRule metadata for Log__c.Status__c to show confetti when the status changes 🥳 🎊

Bugfixes

  • Fixed Null pointer Exception  #447 by updating LogEntryEventHandler to have an extra null check when processing LogEntryTagRule__mdt rules
  • Fixed Default Logger Settings values change the results of unit tests in sandboxes vs. production #453 by simplifying Logger.getUserSettings() to always use default field values, and making LoggerSettingsController responsible for handling prod-specific settings
    • This keeps the behavior of Logger.getUserSettings() consistent in all orgs (instead of prod behaving differently from sandboxes/scratch orgs), while still providing the suggested defaults for a prod org via the loggerSettings LWC/custom tab
    • Some default field values on LoggerSettings__c have also been updated to provide the most detailed settings by default
    • This bugfix also led to the creation of the new public method Logger.createSettings() - this doesn't seem needed in the managed package right now, so public seems sufficient (instead of using global)

Slack Plugin Package Changes

  • Updated SlackLoggerPlugin Apex class to leverage a new field set, Log__c.SlackNotificationFields, to support customization of the fields shown in Slack notifications
    • This field set can either be directly modified (although changes may be reverted during upgrades), or by creating & specifying another field set in the custom metadata record LoggerParameter.SlackLogNotificationFieldSet
    • The Slack remote site setting has also been renamed from Slack.remoteSite-meta.xml to LoggerSlack.remoteSite-meta.xml to ensure there's consistency in having some variation of the word "Log" in all metadata. Some orgs unintentionally had a previously-existing remote site setting (also named just "Slack") unintentionally overwritten - this name change should help avoid overwriting existing remote site settings for Slack.

…ckNotificationFields, to support customization of the fields shown in Slack notifications

This field set can either be directly modified (although changes may be reverted during upgrades), or by creating & specifying another field set in the custom metadata record LoggerParameter.SlackLogNotificationFieldSet

I also renamed the remote site setting from Slack.remoteSite-meta.xml to LoggerSlack.remoteSite-meta.xml to consistently have some variation of the word Log in all metadata
…) to support logging maps of SObjects

Other types of maps, as well as Set<SObject>, are currently considered out of scope
… plugin package, manually generated new package version for slack plugin
…sulted in a few small changes to the field XML files
…ock.json, removed problematic setting 'lockerServiceNext' in scratch definition files
…ifferent emoji for INFO vs lower levels (DEBUG, FINE, FINER, and FINEST)
@jongpie jongpie added Type: Bug Something isn't working Type: Enhancement New feature or request Logging Source: Apex Items related to using Logger within Apex Layer: Configuration Items related to the custom hierarchy setting LoggerSettings__c or any included custom metadata type Layer: Log Management Items related to the custom objects & Logger Console app Layer: Logger Engine Items related to the core logging engine Plugin: Slack labels Feb 13, 2023
@jongpie jongpie force-pushed the feature/sobject-map-support branch from 0283520 to 9e1ced6 Compare February 13, 2023 18:06
@jongpie jongpie had a problem deploying to Experience Cloud Scratch Org February 13, 2023 18:11 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Experience Cloud Scratch Org February 13, 2023 18:58 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Experience Cloud Scratch Org February 13, 2023 19:16 — with GitHub Actions Failure
…nded by Known Issue a1p4V000003BIYGQA4 to circumvent an ongoing environment issue
@jongpie jongpie temporarily deployed to Base Scratch Org February 13, 2023 19:38 — with GitHub Actions Inactive
@jongpie jongpie had a problem deploying to Experience Cloud Scratch Org February 13, 2023 19:38 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Base Scratch Org March 8, 2023 16:43 — with GitHub Actions Failure
@jongpie jongpie temporarily deployed to Base Scratch Org March 8, 2023 16:58 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org March 8, 2023 16:58 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org March 8, 2023 17:05 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Base Scratch Org March 8, 2023 18:00 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org March 8, 2023 18:00 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org March 8, 2023 18:09 — with GitHub Actions Inactive
…rsion

There seems to be an ongoing issue with newer versions of sfdx that causes issues with linking plugins - @W-12652231
@jongpie jongpie force-pushed the feature/sobject-map-support branch from 8bd09a8 to 8f998dd Compare March 8, 2023 18:54
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org March 8, 2023 18:57 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Base Scratch Org March 8, 2023 18:57 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org March 8, 2023 19:10 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org March 8, 2023 19:21 — with GitHub Actions Inactive
…-end (E2) tests to verify certain features & behaviors, as well as to provide examples to Apex developers of how to test their usage of Nebula Logger

This just has some basic tests for now - it'll evolve over the next few releases
@jongpie jongpie force-pushed the feature/sobject-map-support branch from 2420e5e to bc8abe0 Compare March 14, 2023 16:40
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org March 14, 2023 16:45 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Base Scratch Org March 14, 2023 16:45 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org March 14, 2023 16:56 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org March 14, 2023 17:09 — with GitHub Actions Inactive
@codecov
Copy link

codecov bot commented Mar 14, 2023

Codecov Report

Patch coverage: 87.19% and project coverage change: -0.28 ⚠️

Comparison is base (4ca9535) 95.26% compared to head (bc8abe0) 94.99%.

❗ Current head bc8abe0 differs from pull request most recent head 040dbbd. Consider uploading reports for the commit 040dbbd to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #452      +/-   ##
==========================================
- Coverage   95.26%   94.99%   -0.28%     
==========================================
  Files          56       56              
  Lines        5623     5676      +53     
  Branches      114      114              
==========================================
+ Hits         5357     5392      +35     
- Misses        261      279      +18     
  Partials        5        5              
Flag Coverage Δ
Apex 95.43% <87.19%> (-0.33%) ⬇️
LWC 92.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ore/main/configuration/classes/LoggerParameter.cls 100.00% <ø> (ø)
...s/slack/plugin/slack/classes/SlackLoggerPlugin.cls 85.02% <83.47%> (-10.31%) ⬇️
...ain/logger-engine/classes/LogEntryEventBuilder.cls 94.68% <94.11%> (+0.13%) ⬆️
...in/log-management/classes/LogEntryEventHandler.cls 90.39% <100.00%> (+0.06%) ⬆️
...og-management/classes/LoggerSettingsController.cls 98.40% <100.00%> (+0.04%) ⬆️
...-logger/core/main/logger-engine/classes/Logger.cls 95.82% <100.00%> (+0.09%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@jamessimone jamessimone left a comment

Choose a reason for hiding this comment

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

@jongpie one small question - no worries if you want to bump that API version in a subsequent release though. I think moving responsibility for what the default logging level is in a sandbox to the controller is a great change.

@jongpie
Copy link
Owner Author

jongpie commented Mar 15, 2023

@jamessimone awesome, thanks so much for reviewing!

@jongpie jongpie merged commit 46ddff1 into main Mar 15, 2023
@jongpie jongpie deleted the feature/sobject-map-support branch March 15, 2023 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Layer: Configuration Items related to the custom hierarchy setting LoggerSettings__c or any included custom metadata type Layer: Log Management Items related to the custom objects & Logger Console app Layer: Logger Engine Items related to the core logging engine Logging Source: Apex Items related to using Logger within Apex Plugin: Slack tests Relates to Apex or LWC jest tests Type: Bug Something isn't working Type: Enhancement New feature or request
Projects
None yet
3 participants