New Release v4.10.2 - Logger LWC Enhancements #494
jongpie
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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: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!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';
<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.Core Unlocked Package Changes
logger
LWC Enhancementslogger
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';
<c-logger>
to your markup and had something like this in your JavaScript file:<c-logger>
in your markup, and instead import it in your JavaScript file:import
approach:constructor()
connectedCallback()
disconnectedCallback()
renderedCallback()
@wire
properties and methodsconsole
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 LoggerIncludes 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
loggerLWCDemo
lwc to uselogger
LWC's newcreateLogger
function (instead of using<c-logger>
in the markup) as the recommended approach for logging in JavaScriptloggerLWCLegacyDemo
lwc to continue providing an example of using the now-deprecated (but still-supported) approach of using<c-logger>
in markupInstallation Info
Core Unlocked Package - no namespace
Full Changelog: v4.10.1...v4.10.2
sfdx package install --wait 20 --security-type AdminsOnly --package 04t5Y0000023SAGQA2
This discussion was created from the release Logger LWC Enhancements.
Beta Was this translation helpful? Give feedback.
All reactions