jongpie / NebulaLogger

The most robust observability solution for Salesforce experts. Built 100% natively on the platform, and designed to work seamlessly with Apex, Lightning Components, Flow, Process Builder & integrations.
https://nebulalogger.com
MIT License
709 stars 165 forks source link

Double Feature: support for OmniStudio + loosely-coupled dependencies #765

Closed jongpie closed 2 months ago

jongpie commented 2 months ago

Core Unlocked Package Changes

New Support for Loosely-Coupled Dependencies

Resolved #371 by introducing a new CallableLogger Apex class that implements Apex's Callable interface - see the new wiki page for full docs. This class provides dynamic access to Nebula Logger's core features - ISVs and package developers can use this to optionally leverage Nebula Logger in a customer's org when it's available, without requiring a package dependency.

For example, this sample code can be executed in any Salesforce org - and when Nebula Logger is available, 2 log entries will be saved.

// Dynamically create a instance Nebula Logger's Callable Apex class (if it's available)
Type nebulaLoggerCallableType = Type.forName('Nebula', 'CallableLogger') ?? Type.forName('CallableLogger');
Callable nebulaLoggerCallable = (Callable) nebulaLoggerCallableType?.newInstance();
if (nebulaLoggerCallable == null) {
  return;
}

// Example action: Add a basic "hello, world!" INFO entry
Map<String, Object> infoEntryInput = new Map<String, Object>{
  'loggingLevel' => System.LoggingLevel.INFO,
  'message' => 'hello, world!'
};
nebulaLoggerCallable.call('newEntry', infoEntryInput);

// Example action: Add an ERROR entry with an Apex exception
Exception someException = new DmlException('oops');
Map<String, Object> errorEntryInput = new Map<String, Object>{
  'exception' => someException,
  'loggingLevel' => LoggingLevel.ERROR,
  'message' => 'An unexpected exception was thrown'
};
nebulaLoggerCallable.call('newEntry', errorEntryInput);

// Example: Save any pending log entries
nebulaLoggerCallable.call('saveLog', null);

New Support for OmniStudio Logging

Resolved #644 by adding support for logging in OmniStudio, using the new CallableLogger Apex class - see the new wiki page for full docs. The included CallableLogger Apex class can be used in:

Once you've added logging in OmniStudio, any log entries generated in OmniStudio can be seen using the LogEntry__c object's included list view AllOmniStudioLogEntries

image

Slack Plugin Package Changes

Fixed #764 by correcting the logic used in SlackLoggerPlugin to format text fields containing line breaks

Documentation Changes

Started rewriting & consolidating all documentation to live just in the wiki. Currently, content is split across the wiki, README.md, and the GitHub Pages site

Pipeline Changes

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 92.06349% with 10 lines in your changes missing coverage. Please review.

Project coverage is 92.24%. Comparing base (ff06c25) to head (4476cbe).

Files with missing lines Patch % Lines
...g-management/classes/LogManagementDataSelector.cls 30.00% 7 Missing :warning:
...re/main/log-management/classes/LogEntryHandler.cls 89.65% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #765 +/- ## ========================================== - Coverage 93.17% 92.24% -0.93% ========================================== Files 67 74 +7 Lines 6974 7211 +237 Branches 199 199 ========================================== + Hits 6498 6652 +154 - Misses 448 531 +83 Partials 28 28 ``` | [Flag](https://app.codecov.io/gh/jongpie/NebulaLogger/pull/765/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonathan+Gillespie) | Coverage Δ | | |---|---|---| | [Apex](https://app.codecov.io/gh/jongpie/NebulaLogger/pull/765/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonathan+Gillespie) | `94.23% <92.00%> (-1.23%)` | :arrow_down: | | [LWC](https://app.codecov.io/gh/jongpie/NebulaLogger/pull/765/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonathan+Gillespie) | `83.26% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonathan+Gillespie#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.