Releases: jongpie/NebulaLogger
New Logger.exception() methods for Apex developers
Core Unlocked Package Changes
New Logger.exception() methods for Apex developers
This release provides some syntactic sugar for Apex developers when logging exceptions. A common pattern for using Nebula Logger is to log exceptions in try-catch
blocks. Once an exception has been caught, Apex developers have to add 3 lines of code in order to log the exception & re-throw it, as shown below:
try {
insert new Account();
} catch (System.Exception ex) {
Logger.error('something broke 😥', ex);
Logger.saveLog(Logger.SaveMethod.EVENT_BUS);
throw ex;
}
Although 3 lines of code isn't a huge amount of code, it's still tedious to have to repeat the same code in any relevant try-catch
blocks. Now, Apex developers can use the new method overloads Logger.exception()
to consolidate down to 1 line in a catch
block. The end result of the below snippet is identical to the snippet above - both result in a new ERROR
log entry being generated, automatically saved, and then the exception is thrown.
try {
insert new Account();
} catch (System.Exception ex) {
Logger.exception('something broke 😥', ex);
}
The full list of new Logger.exception()
method overloads is shown below. Each of the methods will log an entry with ERROR
logging level, save the log, and then throw the provided exception. Since an exception is always thrown, the method overloads all have a void
return type.
global static void exception(LogMessage logMessage, System.Exception apexException);
global static void exception(LogMessage logMessage, Id recordId, System.Exception apexException);
global static void exception(LogMessage logMessage, SObject record, System.Exception apexException);
global static void exception(LogMessage logMessage, List<SObject> records, System.Exception apexException);
global static void exception(String message, System.Exception apexException);
global static void exception(String message, Id recordId, System.Exception apexException);
global static void exception(String message, SObject record, System.Exception apexException);
global static void exception(String message, List<SObject> records, System.Exception apexException);
Bugfixes
- Bugfix for issue #529 where the optional integration with
api.status.salesforce.com
would cause exceptions in Nebula Logger if the remote site setting was disabled and the callout was still enabled viaLoggerParameter__mdt
recordCallStatusApi
. Now, Nebula Logger internally catches any callout exceptions, which should prevent any downstream issues from occurring.
Apex Test Improvements
- Scope creep: finished a few
TODO
items in the Apex classLogger_Tests
(part of the logger engine layer) so that it's not aware of the log-management layer by rewriting several test methods to remove references toLog__c
andLogEntry__c
. These tests now also use mocks for theSystem.EventBus
class, so they're now much faster 🏎️
Pipeline Enhancements
- @JMercie closed issue #527 by updating Nebula Logger's pipeline & build scripts to use the new
sf
CLI, instead of thesfdx
cli` (PR #532). Thanks to @JMercie for another amazing contribution! 🥳
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.11.1...v4.11.2
- SF CLI:
sf package install --wait 20 --security-type AdminsOnly --package 04t5Y000001TsZAQA0
- SFDX CLI:
sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y000001TsZAQA0
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001TsZAQA0
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001TsZAQA0
Added the Ability to Throw Fault Exception in Flow Actions
A huge thank you to @JMercie for working on this release, and congratulations on their first-ever open source contribution! (PR #516). And many thanks also to @Sidle for suggesting this great enhancement (issue #489).
Core Unlocked Package Changes
Added the Ability to Throw Fault Exceptions in Flow Actions
This release closes #489 by providing a new option when logging in Flow - when logging a Flow fault message (shown as 1
in the screenshot below), you can now have the invocable action automatically re-throw the encountered exception (shown as 2
in the screenshot below). This provides a great way to still display an error to the user & rollback any other DML in the current transaction, while still saving your logging data.
- Updated all 3 Flow invocable logging actions (Apex classes
FlowLogEntry
,FlowRecordLogEntry
, andFlowCollectionLogEntry
) to have a new optionalBoolean
property,shouldThrowFaultMessageException
. When set totrue
, the provided Flow fault message (using theString
propertyfaultMessage
) will be used to create & throw an instance of the standard exception classSystem.FlowException
- Updated
FlowLogger
to handle throwing the exception for all 3 Flow invocable logging actions
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.11.0...v4.11.1
- SF CLI:
sf package install --wait 20 --security-type AdminsOnly --package 04t5Y000001TsX4QAK
- SFDX CLI:
sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y000001TsX4QAK
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001TsX4QAK
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001TsX4QAK
v4.11.0 - Summer '23 Release
Managed Package Release - v4.11.0
This release is for both the unlocked package (as always), as well as the managed package! You can see everything that's changed between v4.10.0
and v4.11.0
by reviewing:
- The v4.11.0 milestone to see all of the issues & pull requests that are included in the this release.
- The diff between v4.10.0 and v4.11.0 to see all of the code & metadata changes that have been committed since the last managed package release.
- The enhancement from is purposefully being excluded from the managed package for this release. Release
v4.10.5
added a custom index to the fieldLogEntry__c.OriginLocation__c
to help optimize anything that filters on this field, such as SOQL queries, list views, reports, etc. This was implemented using the recently-added metadata typeCustomIndex
, which is considered generally-available (GA). However, there have been a handful of related errors reported due to theCustomIndex
metadata, so it's being excluded from the managed package this release as a precaution to avoid any related upgrade issues. - There are some recent label changes to some existing metadata - most notably, the new lightning app "Logger Console" has been relabeled to "Nebula Logger". This change will not be automatically applied to orgs that are upgrading - you will continue to see the lightning app labeled as "Logger Console" in your org. It is completely your choice if you would like to keep the existing label, or manually relabel it in your org. If you would like to relabel it in your org, you can edit it under
Setup
-->App Manager
--> edit theLogger Console
app.
Core Unlocked Package Changes - v4.11.0
Metadata API Version Updated to v58.0
- Updated all metadata to API
v58.0
(Summer '23 release) - Updated some picklist values to have options for API v58.0 and 59.0
- Simplified some Apex calls to
String.join()
to remove extra conversions ofSet<String>
toList<String>
- Summer '23 now supports iterating overSet<Object>
- Retrieved the metadata for fields & objects so the repo's version more closely matches the XML returned by the platform
logEntryEventStream
LWC Enhancements
Currently, the LWC logEntryEventStream
uses the emp API to subscribe/display the stream of LogEntryEvent__e
platform events, which counts towards your org's daily limit for platform event delivery allocation (the docs for Platform Event Allocations has more details on this limit).
To help mitigate the usage of the org daily limit for platform event daily delivery allocations, this release includes 2 related changes:
-
Added new control "Max Number of Events to Stream" (shown as
#1
in the screenshot below) to set the max number of events to deliver to the LWC before the component auto-pauses the stream. A counter of the total number of events streamed for your session has also been added (shown as#2
in the screenshot below), as well as a<lightning-progress-ring>
to show the percentage of events to stream before the component auto-pauses itself (shown as#3
in the screenshot below) -
Resolved #488 by adding new
LoggerParameter__mdt
recordEnableLogEntryEventStream
- when set to false, the entire component is completely disabled for the entire organization. The buttons on the LWC are hidden, input elements are disabled, and a warning message is displayed:
loggerHomeHeader
LWC Enhancements
- Added plugin information to the header component in 2 places:
-
Added a count of enabled plugins directly below the lightning card's title. This only displays when 1 or more plugins are enabled in your org (not available in the managed package)
-
Added a comma-separated list of enabled plugins to 'Environment Details' button modal. This only displays when 1 or more plugins are enabled in your org (not available in the managed package)
-
LoggerHomePage
FlexiPage Changes
-
Updated the
LoggerAdmin
dashboard component on theLoggerHomePage
FlexiPage to not hide the dashboard on error (controlled by updating thecomponentInstanceProperties
attributehideOnError
tofalse
- shown in App Builder with MS Paint's amazing ⚡ shape in the screenshot below). Previously, if the dashboard had any errors (such as permission issues with the running user), the home page just displayed an unhelpful empty space in place of the dashboard, making it hard to tell if the page had loaded properly or if the dashboard had an error. Now, the dashboard will display either way.
LoggerAdmin
Dashboard Changes
- Removed the XML node
<runningUser>test-triqc8kt7jj0@example.com</runningUser>
inLoggerAdmin.dashboard-meta.xml
that caused problems for orgs that deploy the metadata (instead of using the unlocked or managed packages)- This value was from a scratch org used for building the dashboard, and including it in the metadata worked fine when deploying to other scratch orgs & when creating/installing package versions (even though that particular username would not exist in other orgs). However, when deploying Nebula Logger's metadata to production orgs, the deployment would fail due to not being able to find the matching user. Removing the XML node entirely avoids the deployment issue altogether, and seems cleaner than storing a random scratch org username inside of
git
- This value was from a scratch org used for building the dashboard, and including it in the metadata worked fine when deploying to other scratch orgs & when creating/installing package versions (even though that particular username would not exist in other orgs). However, when deploying Nebula Logger's metadata to production orgs, the deployment would fail due to not being able to find the matching user. Removing the XML node entirely avoids the deployment issue altogether, and seems cleaner than storing a random scratch org username inside of
More Label Changes
- Updated the labels for several metadata items to start with "Nebula Logger" (instead of just "Logger") for clarity on what metadata is part of Nebula Logger - this is especially helpful in orgs that deploy the metadata (instead of using the unlocked or managed packages). The changed metadata includes:
AnimationRule
CustomPermission
FlexiPage
GlobalValueSet
- LWCs
- Permission Sets
- Visualforce page
Updated Permission Sets
- Small bugfix from
v4.10.6
release - updated theLoggerAdmin
&LoggerLogViewer
permission sets to add missing Apex class access toLoggerHomeHeaderController
README.md
, Pipeline & Release Notes Changes
- Updated
README.md
to include the package installation command for the SF CLI (in addition to the SFDX CLI) - Updated
README.md
to use the "classic" commands for SFDX CLI to better support people that are still using older versions of the SFDX CLI - Updated the pipeline's pwsh script so it automatically update the package version ID in
README.md
for the new SF CLI command - Updated release notes to start including the SF CLI command (see below!)
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.10.6...v4.11.0
- SF CLI:
sf package install --wait 30 --security-type AdminsOnly --package 04t5Y0000023SI6QAM
- SFDX CLI:
sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y0000023SI6QAM
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SI6QAM
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SI6QAM
Core Managed Package - Nebula
namespace
Full Changelog: v4.9.0...v4.10.0
- SF CLI:
sf package install --wait 30 --security-type AdminsOnly --package 04t5Y0000023SI1QAM
- SFDX CLI:
sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y0000023SI1QAM
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SI1QAM
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SI1QAM
Added More Fields on LogEntryEvent__e, Log__c, and LogEntry__c
This release is focused on automatically capturing & storing some new data points (in a few different areas) that provide additional context for monitoring & reporting.
Core Unlocked Package Changes
Logging in Lightning Components: New "Browser Details" fields on LogEntry__c
-
Resolved #225 by updating the
logger
LWC (logEntryBuilder.js
mostly) to capture details about the user's browser & screen. These details are automatically now stored in these new fields onLogEntryEvent__e
andLogEntry__c
:New Fields Source of Data LogEntryEvent__e.BrowserFormFactor__c
andLogEntry__c.BrowserFormFactor__c
The value of FORM_FACTOR
, imported usingimport FORM_FACTOR from '@salesforce/client/formFactor';
LogEntryEvent__e.BrowserLanguage__c
andLogEntry__c.BrowserLanguage__c
The value of window.navigator.language
LogEntryEvent__e.BrowserScreenResolution__c
andLogEntry__c.BrowserScreenResolution__c
The value of window.screen.availWidth + ' x ' + window.screen.availHeight
LogEntryEvent__e.BrowserUrl__c
andLogEntry__c.BrowserUrl__c
The value of window.location.href
LogEntryEvent__e.BrowserUserAgent__c
andLogEntry__c.BrowserUserAgent__c
The value of window.navigator.userAgent
LogEntryEvent__e.BrowserWindowResolution__c
andLogEntry__c.BrowserWindowResolution__c
The value of window.innerWidth + ' x ' + window.innerHeight
Logging in Flow: New Flow Metadata fields on LogEntry__c
-
Resolved #451 by capturing some additional details about the running Flow via the object
FlowDefinitionView
. These details are automatically now stored in these new fields:New Fields Source of Data LogEntry__c.FlowRecordTriggerType__c
The value of FlowDefinitionView.RecordTriggerType
LogEntry__c.FlowTriggerOrder__c
The value of FlowDefinitionView.TriggerOrder
LogEntry__c.FlowTriggerSObjectType__c
The value of FlowDefinitionView.TriggerObjectOrEvent.QualifiedApiName
Organization Details: New & Deprecated fields on LogEntryEvent__e
and Log__c
-
"Renamed" (by creating new fields) some fields on
LogEntryEvent__e
andLog__c
to have a more consistent naming convention. Note that the old fields are still included in the core package and are still populated so that orgs have time to update any existing reporting, etc. Eventually, the old fields will be fully removed from the package.Field Change Source of Data Deprecated Log__c.ApiReleaseNumber__c
and replaced it withLog__c.OrganizationReleaseNumber__c
Retrieved via the optional callout to https://api.status.salesforce.com
Deprecated Log__c.ApiReleaseVersion__c
and replaced it withLog__c.OrganizationReleaseVersion__c
Retrieved via the optional callout to https://api.status.salesforce.com
Deprecated LogEntryEvent__e.ApiVersion__c
andLog__c.ApiVersion__c
and replaced them withLogEntryEvent__e.OrganizationApiVersion__c
andLog__c.OrganizationApiVersion__c
The value of Logger.getOrganizationVersion()
Added new field Log__c.OrganizationLocation__c
Retrieved via the optional callout to https://api.status.salesforce.com
Logger Engine Changes
-
Made some internal changes to the
logger
LWC so that the JavaScript code's approach more closely aligns with the Apex code's approach. This should not have any functional changes (hopefully 😅), this is just to try to provide a little more consistency within the codebase for approaching the same goal (logging) in 2 different languages (Apex & JavaScript).Item In Apex In JavaScript Object used to store in-memory logging data LogEntryEvent__e
objectComponentLogEntry
inner class inlogEntryBuilder.js
Internal method used to access/update in-memory logging data Instance method LogEntryEventBuilder.getLogEntryEvent()
Instance method LogEntryEventBuilder.getComponentLogEntry()
inlogEntryBuilder.js
Bugfixes
- Small bugfix for logging in Flow: Added an extra guard clause in the private instance method
LogEntryHandler.setFlowDefinitionFields()
to prevent a possibleNullPointerException
. Previously, the code assumed that whenOriginLocation__c == 'Flow'
, thenOriginLocation__c
would be the API name of the logging Flow. However, this may not always be the case, especially since the invocable actions currently rely on admins/devs to provide the Flow's API name, which is inherently an imperfect approach - but there isn't currently a way in Apex or Flow to automatically determine the Flow's API name, so the new guard clause helps avoid an exception.
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.10.5...v4.10.6
- SFDX CLI:
sfdx package install --wait 20 --security-type AdminsOnly --package 04t5Y0000023SCqQAM
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SCqQAM
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SCqQAM
Added Custom Index for LogEntry__c.OriginLocation__c
Core Unlocked Package Changes
Added Custom Index for LogEntry__c.OriginLocation__c
- Resolved #400 by adding a custom index for the field
LogEntry__c.OriginLocation__c
, using the newCustomIndex
metadata type. This should help to improve queries & reports that filter on this field.- This release is intentionally very small - since
CustomIndex
is a relatively new metadata type (released last year), this is being released in isolation, just as a precaution. Based on testing of the index, there are not any issues anticipated with this change.
- This release is intentionally very small - since
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.10.4...v4.10.5
- SFDX CLI:
sfdx package install --wait 20 --security-type AdminsOnly --package 04t5Y0000023SCHQA2
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SCHQA2
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SCHQA2
Added Home Page & Dashboard to Console App
Core Unlocked Package Changes
This release is focused on some related enhancements to help improve the usability & usefulness of the included lightning console app, including:
- Streamline access to some of Nebula Logger's features (namely, some of the included custom LWCs)
- Make it easier for admins & developers to find helpful resources for using/configuring Nebula Logger
- Provide admins & developers with a pre-built dashboard (and more reports) within the core package
These enhancements have culminated in a new home page, available in the console app
Console app changes
-
Changed label of console app from "Logger Console" to "Nebula Logger". The API name of the app,
LoggerConsole
, is not changing - this is just a label change. -
Added new home page
LoggerHomePage.flexipage-meta.xml
to the console app (configured as the app's default home page). It includes:-
A new custom header component,
loggerHomeHeader
, that provides quick access to information about the current environment & quick access to the latest release notes for Nebula Logger
-
A tab set that includes 4 tabs:
- Dashboard: the first & default tab, this displays the new
LoggerAdmin
dashboard that is now included (previously, this dashboard was available as a separate plugin package) - Settings: this displays the existing LWC
loggerSettings
, which was previously available via the custom tab "Logger Settings" - Event Stream: this displays the existing LWC
logEntryEventStream
, which was previously available via the custom tab "Log Entry Event Stream" - Batch Purge: this displays the existing LWC
logBatchPurge
, which was previously available via the custom tab "Log Batch Purge"
- Dashboard: the first & default tab, this displays the new
-
-
Removed several custom tabs from the console app's navigation menu. Since the new home page displays several custom LWCs, their corresponding customs tabs are no longer included in the console app's navigation
-
⚠For orgs that use the unlocked package & are upgrading: by default, you will still see the old navigation options. You can either leave them as-is, or you can reset the tabs to use the new defaults. To reset & see the new navigation options, open the console app:
- In the console's navigation dropdown menu, select the "Edit" option at the bottom
- In the modal that opens, select the "Reset Navigation to Default" option at the bottom and click "Save"
-
Reports & Dashboard Changes
- The core package now includes a dashboard out of the box,
LoggerAdmin
. The dashboard is based on 7 new reports that are also included:LogEntryDailyRetentionSummary
LogEntryDailySummary
LogEntryDetails
LogEntryOriginSummary
LogEntryScenarioSummary
LogEntrySummary
LogEntryTagDetails
LWC Changes
-
logBatchPurge
LWC- Updated the LWC's config to make
isExposed = true
and added the targetlightning__HomePage
so that the component can be added in App Builder to the new home page - Added a confirmation prompt to the "Run Batch Purge" button to help prevent accidentally starting the job
- Moved the spinner to only overlay on the
lightning-datatable
(when refreshing the data), instead of the spinner overlaying the entire page - Cleaned up some various code bits in the HTML and JS files (mostly to make some function names & terminology more consistent)
- Updated the LWC's config to make
-
logEntryEventStream
LWC Enhancements- Updated the LWC's config to make
isExposed = true
and added the targetlightning__HomePage
so that the component can be added in App Builder to the new home page - Removed a line in
connectedCallback()
that was settingdocument.title
- Minor CSS changes to improve the layout of the component within the home page's tab set
- Updated the LWC's config to make
-
loggerSettings
LWC Enhancements- Updated the LWC's config to make
isExposed = true
and added the targetlightning__HomePage
so that the component can be added in App Builder to the new home page - Removed a line in
connectedCallback()
that was settingdocument.title
- Updated the LWC's config to make
-
loggerHomeHeader
LWC - New!- Added new component that's used by the new home page. It provides a link to the current release's release notes, as well as a modal that provides environment details, using a combination of information from the
Organization
object and from making a callout to Salesforce's Status API,https://api.status.salesforce.com/v1/instances/
.
- Added new component that's used by the new home page. It provides a link to the current release's release notes, as well as a modal that provides environment details, using a combination of information from the
Backend Changes
- Bugfix: fixed the instance method
LogEntryEventBuilder.setExceptionDetails(System.Exception apexException)
so it properly handlesnull
values - Bugfix: fixed the instance method
LogManagementDataSelector.getUsersByNameSearch(String searchTerm)
to useLIMIT 20
so it doesn't hit a SOQL query limit in large orgs 😨 - Added public method
Logger.callStatusApi()
, used to centralize some existing code that is used to retrieve additional orgs details from Salesforce's Status API,https://api.status.salesforce.com/v1/instances/
. Note that this method is only intended to be used internally by Nebula Logger and could change in future releases.
Logger Admin Dashboard Plugin - Now Deprecated! ⚠️
The Logger Admin Dashboard plugin is now deprecated, and will need to be uninstalled prior to upgrading to v4.10.4
. The same dashboard & reports are now included in the core package, with one change: the dashboard is no longer a dynamic dashboard (due to the org limit of 5 dynamic dashboards).
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.10.3...v4.10.4
- SFDX CLI:
sfdx package install --wait 20 --security-type AdminsOnly --package 04t5Y0000023SC7QAM
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SC7QAM
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SC7QAM
New LoggerSettings__c Fields StartTime__c and EndTime__c
Core Unlocked Package Changes
Added New LoggerSettings__c
Fields StartTime__c
and EndTime__c
This release provides admins & developers even more control over configuring Nebula Logger for different users by adding the ability to schedule & expire specific LoggerSettings__c
records, using 2 new datetime fields: StartTime__c
and EndTime__c
.
Scenario | Behavior |
---|---|
StartTime__c and EndTime__c are both null |
No change to existing behavior |
StartTime__c is set, EndTime__c is null |
The LoggerSettings__c record is only used for the specified SetupOwnerId if StartTime__c <= System.now() |
StartTime__c is null , EndTime__c is set |
The LoggerSettings__c record is only used for the specified SetupOwnerId if EndTime__c >= System.now() |
StartTime__c and EndTime__c are both set |
The LoggerSettings__c record is only used for the specified SetupOwnerId if both StartTime__c <= System.now() and EndTime__c >= System.now() |
The new fields have also been added to the "Logger Settings" custom tab (which displays the loggerSettings
LWC)
-
They appear in the datatable, after the "Setup Location" and "Setup Owner" fields, as shown in the screenshot below:
-
They appear in the modal used for creating & editing records, within the "General Settings" section. The fields "Enabled" and "Logging Level" have been moved to the beginning of the "Logger Engine Settings" section, as shown in the screenshot below:
-
Also cleaned up some legacy code used for displaying the fields in the 'General Settings' section of the
loggerSettings
lwc - all fields are now controlled byloggerSettingsPageLayout.js
, which makes maintenance/changes easier
Pipeline Changes
- Updated the pwsh script used by the pipeline so it now automatically updates README.md to have the new the package version ID in the unlocked package's sfdx install command. Previously, this value was being manually updated for each release.
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.10.2...v4.10.3
- SFDX CLI:
sfdx package install --wait 20 --security-type AdminsOnly --package 04t5Y0000023SAfQAM
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SAfQAM
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SAfQAM
Logger LWC Enhancements
Many thanks to @jefersonchaves for all of the work on this release! This release makes some changes and improvements to logging in lightning components, and provides support for logging in additional lifecycle events that would have previously failed to log.
logger
LWC for logging in Aura/LWC: This release has 2 important changes:
- The behavior of the
getUserSettings()
to return a read-only object (in previous versions, this object was modifiable). This change will break any code that previously relied ongetUserSettings()
to change in-memory settings values. If this negatively impacts your code, please let me know! - There is now a new recommended approach for using the
logger
LWC within your own components. Instead of adding<c-logger>
directly in your HTML markup, you should now instead import it in your JavaScript file, usingimport { createLogger } from 'c/logger';
- Note: the old approach of adding
<c-logger>
directly in your HTML markup is still supported (and I have no plans to remove the functionality) - but due to limitations with its approach (namely, it can't be used for logging in all lifecycle events), it is now considered deprecated & is no longer the recommended way to log in JavaScript.
- Note: the old approach of adding
Core Unlocked Package Changes
logger
LWC Enhancements
- @jefersonchaves resolved #280 and #483 via PR #401 - the
logger
LWC can now be used to log during all LWC lifecycle events and@wire
properties/methods. Please note that this requires updating your own components to useimport { createLogger } from 'c/logger';
- Previously, you would have added
<c-logger>
to your markup and had something like this in your JavaScript file:import { LightningElement } from 'lwc'; export default class SomeExampleComponent extends LightningElement { someFunction() { const logger = this.template.querySelector('c-logger'); logger.info('hello, world'); logger.saveLog(); } }
- Now, you can remove
<c-logger>
in your markup, and instead import it in your JavaScript file:import { LightningElement } from 'lwc'; import { createLogger } from 'c/logger'; export default class SomeExampleComponent extends LightningElement { logger = createLogger(); someFunction() { this.logger.info('hello, world'); this.logger.saveLog(); } }
- These lifecycle events have been tested and should work with the new
import
approach:constructor()
connectedCallback()
disconnectedCallback()
renderedCallback()
@wire
properties and methods
- Previously, you would have added
- Improved the
console
statements that are generated by Nebula Logger whenconsole
logging is enabled viaLoggerSettings__c
. Now, each log entry created in JavaScript:-
Includes
Nebula Logger
as a prefix for any output - this makes it to know which entries in your browser's console were generated by Nebula Logger -
Includes an additional (collapsed) output to provides more details for each entry, including the entry object itself and a JavaScript trace - these additional details can help with troubleshooting issues in your components and understanding which components generated specific entries
-
Recipes Changes
- Updated
loggerLWCDemo
lwc to uselogger
LWC's newcreateLogger
function (instead of using<c-logger>
in the markup) as the recommended approach for logging in JavaScript - Added
loggerLWCLegacyDemo
lwc to continue providing an example of using the now-deprecated (but still-supported) approach of using<c-logger>
in markup
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.10.1...v4.10.2
- SFDX CLI:
sfdx package install --wait 20 --security-type AdminsOnly --package 04t5Y0000023SAGQA2
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SAGQA2
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023SAGQA2
Added the ability to save a subset of LogEntryEvent__e records, based on entry logging level
Core Unlocked Package Changes
New LoggerSettings__c
Field DefaultPlatformEventStorageLoggingLevel__c
-
Reorganized all fields in the
loggerSettings
lwc to be grouped into 2 main sections: Logger Engine Settings and Log Management Settings (shown in the screenshot below) -
Resolved #475 by adding a new settings field,
LoggerSettings__c.DefaultPlatformEventStorageLoggingLevel__c
- this field can be used to optionally control whichLogEntryEvent__e
records are saved in custom objects, based on their logging level. For example, in the screenshot below-
The existing field
LoggingLevel__c
(red box) is configured with the valueFINEST
, so allLogEntryEvent__e
records will be published through theEventBus
-
The new field
DefaultPlatformEventStorageLoggingLevel__c
(green box) is configured with the valueINFO
, so only entries with a logging level ofERROR
,WARN
, orINFO
will be stored in the custom objectsLog__c
andLogEntry__c
.
-
Bugfixes
- Fixed #478 by replacing an unnecessary query with a mock
Network
record - thanks to @rafahg for reporting this issue!
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.10.0...v4.10.1
- SFDX CLI:
sfdx package install --wait 20 --security-type AdminsOnly --package 04t5Y0000015nYaQAI
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015nYaQAI
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015nYaQAI
v4.10.0 - Spring '23 Release
Managed Package Release - v4.10.0
Happy belated Spring '23 release! 🥳 A little behind schedule, this release is for both the unlocked package (as always), as well as the managed package! For orgs that are upgrading to this version of the managed package, you can see everything that's changed between v4.9.0
and v4.10.0
by reviewing:
- The v4.10.0 milestone to see all of the issues & pull requests that are included in the this release.
- The diff between v4.9.0 and v4.10.0 to see all of the code & metadata changes that have been committed since the last managed package release.
Core Unlocked Package Changes - v4.10.0
Metadata API Version
- Updated all metadata from API
v56.0
(Winter '23 release) tov57.0
(Spring '23 release) - Removed the now-deprecated picklist value "v56.0 - Winter '23 Release" in the field
Log__c.ApiVersion__c
, added "v58.0 - Summer '23 Release"
Apex Logging Improvements
- @jamessimone added several new methods in PR #471 to add support for logging instances of
Database.LeadConvertResult
- thanks to @justin-lyon for pointing out that this was missing from the list of supportedDatabase
classes that were added inv4.7.4
!-
Added new instance method overload
LogEntryEventBuilder.setDatabaseResult(Database.LeadConvertResult leadConvertResult)
-
Added several static method overloads in
Logger
for easily loggingDatabase.LeadConvertResult
instances. The full list of method overloads is:global static LogEntryEventBuilder error(LogMessage logMessage, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder error(String message, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder warn(LogMessage logMessage, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder warn(String message, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder info(LogMessage logMessage, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder info(String message, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder debug(LogMessage logMessage, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder debug(String message, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder fine(LogMessage logMessage, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder fine(String message, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder finer(LogMessage logMessage, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder finer(String message, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder finest(LogMessage logMessage, Database.LeadConvertResult leadConvertResult); global static LogEntryEventBuilder finest(String message, Database.LeadConvertResult leadConvertResult);
-
Added static methods overloads for
Logger.logDatabaseErrors()
for loggingList<Database.LeadConvertResult>
errors. If the list of lead convert results includes 1 or more errors (based on isSuccess() == false), then a new log entry is added, and the JSON of any unsuccessful results is serialized/stored in the log entry.global static LogEntryEventBuilder logDatabaseErrors(System.LoggingLevel loggingLevel, LogMessage logMessage, List<Database.LeadConvertResult> leadConvertResults); global static LogEntryEventBuilder logDatabaseErrors(System.LoggingLevel loggingLevel, String message, List<Database.LeadConvertResult> leadConvertResults);
-
Bugfixes
- Worked with @jamessimone to fix #436 that prevented data from being fully loaded in the "Open Viewer" quick action on
Log__c
- thanks to @solo-1234 for reporting this issue!- Small enhancement: added a
lightning-spinner
tologViewer
that's displayed on load
- Small enhancement: added a
- Fixed #469 by updating how some tests query for the autoproc user - thanks to @YodaDaCoda for reporting this & providing the solution!
Code Cleanup
- Bumped all metadata to API v57.0 (Summer '23 release)
- Moved the private constant
LogEntryEventBuilder.ORGANIZATION_API_VERSION
toLogger.ORGANIZATION_API_VERSION
soLogger
can dynamically include the API version when saving with the save methodLogger.SaveMethod.REST
- Finally removed the last
@future
method in the codebase,LogEntryEventHandler.setStatusApiDetails()
(used to call the Salesforce Status API), and replaced it with a private queueable classLogEntryEventHandler.StatusApiCalloutQueueable
Documentation Improvements
- Added
sfdx
commands inREADME.md
so everyone can easily copy & paste the recommended commands to install Nebula Logger's unlocked & managed core packages
Pipeline Changes
- Updated
sfdx
to version7.191.1
- Updated
sfdx
commands inbuild.yml
andpackage.json
to use the new syntax for commands & parameters
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.9.11...v4.10.0
- SFDX CLI:
sfdx package install --wait 20 --security-type AdminsOnly --package 04t5Y0000015nWjQAI
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015nWjQAI
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015nWjQAI
Core Managed Package - Nebula
namespace
Full Changelog: v4.9.0...v4.10.0
- SFDX CLI:
sfdx package install --wait 20 --security-type AdminsOnly --package 04t5Y0000015nWeQAI
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015nWeQAI
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015nWeQAI