{ componentLogEntry }, null);
+
+ System.assertEquals(1, Logger.saveLogCallCount);
+ System.assertEquals(1, LoggerMockDataStore.getEventBus().getPublishCallCount());
+ System.assertEquals(1, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size());
+ LogEntryEvent__e publishedLogEntryEvent = (LogEntryEvent__e) LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().get(0);
+ System.assertEquals('Component', publishedLogEntryEvent.OriginType__c);
+ System.assertEquals(componentLogEntry.loggingLevel, publishedLogEntryEvent.LoggingLevel__c);
+ System.assertEquals(componentLogEntry.message, publishedLogEntryEvent.Message__c);
+ System.assertEquals(componentLogEntry.timestamp, publishedLogEntryEvent.Timestamp__c);
+ System.assertEquals(componentLogEntry.error.message, publishedLogEntryEvent.ExceptionMessage__c);
+ System.assertEquals(componentLogEntry.error.stack, publishedLogEntryEvent.ExceptionStackTrace__c);
+ System.assertEquals(componentLogEntry.error.type, publishedLogEntryEvent.ExceptionType__c);
}
@IsTest
diff --git a/nebula-logger/recipes/classes/LoggerLWCDemoController.cls b/nebula-logger/recipes/classes/LoggerLWCDemoController.cls
new file mode 100644
index 000000000..1f2429f64
--- /dev/null
+++ b/nebula-logger/recipes/classes/LoggerLWCDemoController.cls
@@ -0,0 +1,7 @@
+@SuppressWarnings('PMD.ApexDoc')
+public with sharing class LoggerLWCDemoController {
+ @AuraEnabled
+ public static void throwSomeError() {
+ throw new DmlException('Some Error!!');
+ }
+}
diff --git a/nebula-logger/recipes/classes/LoggerLWCDemoController.cls-meta.xml b/nebula-logger/recipes/classes/LoggerLWCDemoController.cls-meta.xml
new file mode 100644
index 000000000..891916bb0
--- /dev/null
+++ b/nebula-logger/recipes/classes/LoggerLWCDemoController.cls-meta.xml
@@ -0,0 +1,5 @@
+
+
+ 54.0
+ Active
+
diff --git a/nebula-logger/recipes/lwc/loggerLWCDemo/loggerLWCDemo.html b/nebula-logger/recipes/lwc/loggerLWCDemo/loggerLWCDemo.html
index 646490b0a..2928f9222 100644
--- a/nebula-logger/recipes/lwc/loggerLWCDemo/loggerLWCDemo.html
+++ b/nebula-logger/recipes/lwc/loggerLWCDemo/loggerLWCDemo.html
@@ -14,6 +14,7 @@
+
diff --git a/nebula-logger/recipes/lwc/loggerLWCDemo/loggerLWCDemo.js b/nebula-logger/recipes/lwc/loggerLWCDemo/loggerLWCDemo.js
index 0ebd8f740..37a711ebe 100644
--- a/nebula-logger/recipes/lwc/loggerLWCDemo/loggerLWCDemo.js
+++ b/nebula-logger/recipes/lwc/loggerLWCDemo/loggerLWCDemo.js
@@ -5,6 +5,7 @@
/* eslint-disable no-console */
import { LightningElement } from 'lwc';
+import throwSomeError from '@salesforce/apex/LoggerLWCDemoController.throwSomeError';
const LOGGER_NAME = 'c-logger';
@@ -25,6 +26,22 @@ export default class LoggerLWCDemo extends LightningElement {
this.tagsString = event.target.value;
}
+ async logApexErrorExample() {
+ console.log('running logApexError for btn');
+ const logger = this.template.querySelector(LOGGER_NAME);
+ console.log(JSON.parse(JSON.stringify(logger)));
+ await throwSomeError()
+ .then(result => {
+ console.log('the result', JSON.parse(JSON.stringify(result)));
+ })
+ .catch(error => {
+ console.log('apex error', error);
+ console.log('and a stack trace', new Error().stack);
+ const entry = logger.error(this.message).setError(error).addTag('lwc logging demo');
+ console.log('entry==', JSON.parse(JSON.stringify(entry)));
+ });
+ }
+
logErrorExample() {
console.log('running logError for btn');
const logger = this.template.querySelector(LOGGER_NAME);
diff --git a/nebula-logger/recipes/profiles/Admin.profile-meta.xml b/nebula-logger/recipes/profiles/Admin.profile-meta.xml
index 949410f39..cf6ddd84c 100644
--- a/nebula-logger/recipes/profiles/Admin.profile-meta.xml
+++ b/nebula-logger/recipes/profiles/Admin.profile-meta.xml
@@ -2557,6 +2557,10 @@
Log__c
Hidden
+
+ Logger_lwc_demo
+ DefaultOn
+
LoggerSettings
Hidden
@@ -2566,700 +2570,4 @@
Hidden
Salesforce
-
- true
- ActivateContract
-
-
- true
- ActivateOrder
-
-
- true
- ActivitiesAccess
-
-
- true
- AddDirectMessageMembers
-
-
- true
- AllowUniversalSearch
-
-
- true
- AllowViewKnowledge
-
-
- true
- ApexRestServices
-
-
- true
- ApiEnabled
-
-
- true
- ApproveContract
-
-
- true
- AssignPermissionSets
-
-
- true
- AssignTopics
-
-
- true
- AuthorApex
-
-
- true
- BulkMacrosAllowed
-
-
- true
- CanInsertFeedSystemFields
-
-
- true
- CanUseNewDashboardBuilder
-
-
- true
- CanVerifyComment
-
-
- true
- ChangeDashboardColors
-
-
- true
- ChatterEditOwnPost
-
-
- true
- ChatterEditOwnRecordPost
-
-
- true
- ChatterFileLink
-
-
- true
- ChatterInternalUser
-
-
- true
- ChatterInviteExternalUsers
-
-
- true
- ChatterOwnGroups
-
-
- true
- ConnectOrgToEnvironmentHub
-
-
- true
- ConsentApiUpdate
-
-
- true
- ContentAdministrator
-
-
- true
- ContentWorkspaces
-
-
- true
- ConvertLeads
-
-
- true
- CreateCustomizeDashboards
-
-
- true
- CreateCustomizeFilters
-
-
- true
- CreateCustomizeReports
-
-
- true
- CreateDashboardFolders
-
-
- true
- CreateLtngTempFolder
-
-
- true
- CreateReportFolders
-
-
- true
- CreateTopics
-
-
- true
- CreateWorkspaces
-
-
- true
- CustomizeApplication
-
-
- true
- DataExport
-
-
- true
- DelegatedTwoFactor
-
-
- true
- DeleteActivatedContract
-
-
- true
- DeleteTopics
-
-
- true
- DistributeFromPersWksp
-
-
- true
- EditActivatedOrders
-
-
- true
- EditBrandTemplates
-
-
- true
- EditCaseComments
-
-
- true
- EditEvent
-
-
- true
- EditHtmlTemplates
-
-
- true
- EditKnowledge
-
-
- true
- EditMyDashboards
-
-
- true
- EditMyReports
-
-
- true
- EditOppLineItemUnitPrice
-
-
- true
- EditPublicDocuments
-
-
- true
- EditPublicFilters
-
-
- true
- EditPublicTemplates
-
-
- true
- EditReadonlyFields
-
-
- true
- EditTask
-
-
- true
- EditTopics
-
-
- true
- EmailMass
-
-
- true
- EmailSingle
-
-
- true
- EnableCommunityAppLauncher
-
-
- true
- EnableNotifications
-
-
- true
- ExportReport
-
-
- true
- GiveRecognitionBadge
-
-
- true
- ImportCustomObjects
-
-
- true
- ImportLeads
-
-
- true
- ImportPersonal
-
-
- true
- InboundMigrationToolsUser
-
-
- true
- InstallPackaging
-
-
- true
- LightningConsoleAllowedForUser
-
-
- true
- LightningExperienceUser
-
-
- true
- ListEmailSend
-
-
- true
- ManageAnalyticSnapshots
-
-
- true
- ManageAuthProviders
-
-
- true
- ManageBusinessHourHolidays
-
-
- true
- ManageC360AConnections
-
-
- true
- ManageCMS
-
-
- true
- ManageCallCenters
-
-
- true
- ManageCases
-
-
- true
- ManageCategories
-
-
- true
- ManageCertificates
-
-
- true
- ManageContentPermissions
-
-
- true
- ManageContentProperties
-
-
- true
- ManageContentTypes
-
-
- true
- ManageCustomPermissions
-
-
- true
- ManageCustomReportTypes
-
-
- true
- ManageDashbdsInPubFolders
-
-
- true
- ManageDataCategories
-
-
- true
- ManageDataIntegrations
-
-
- true
- ManageDynamicDashboards
-
-
- true
- ManageEmailClientConfig
-
-
- true
- ManageEntitlements
-
-
- true
- ManageExchangeConfig
-
-
- true
- ManageHealthCheck
-
-
- true
- ManageHubConnections
-
-
- true
- ManageInteraction
-
-
- true
- ManageInternalUsers
-
-
- true
- ManageIpAddresses
-
-
- true
- ManageKnowledge
-
-
- true
- ManageKnowledgeImportExport
-
-
- true
- ManageLeads
-
-
- true
- ManageLoginAccessPolicies
-
-
- true
- ManageMobile
-
-
- true
- ManageNetworks
-
-
- true
- ManagePackageLicenses
-
-
- true
- ManagePasswordPolicies
-
-
- true
- ManageProfilesPermissionsets
-
-
- true
- ManagePropositions
-
-
- true
- ManagePvtRptsAndDashbds
-
-
- true
- ManageRecommendationStrategies
-
-
- true
- ManageReleaseUpdates
-
-
- true
- ManageRemoteAccess
-
-
- true
- ManageReportsInPubFolders
-
-
- true
- ManageRoles
-
-
- true
- ManageSearchPromotionRules
-
-
- true
- ManageSharing
-
-
- true
- ManageSolutions
-
-
- true
- ManageSubscriptions
-
-
- true
- ManageSynonyms
-
-
- true
- ManageTrustMeasures
-
-
- true
- ManageUnlistedGroups
-
-
- true
- ManageUsers
-
-
- true
- MassInlineEdit
-
-
- true
- MergeTopics
-
-
- true
- ModerateChatter
-
-
- true
- ModifyAllData
-
-
- true
- ModifyDataClassification
-
-
- true
- ModifyMetadata
-
-
- true
- NewReportBuilder
-
-
- true
- OutboundMigrationToolsUser
-
-
- true
- Packaging2
-
-
- true
- Packaging2Delete
-
-
- true
- PrivacyDataAccess
-
-
- true
- RemoveDirectMessageMembers
-
-
- true
- ResetPasswords
-
-
- true
- RunReports
-
-
- true
- ScheduleJob
-
-
- true
- ScheduleReports
-
-
- true
- SelectFilesFromSalesforce
-
-
- true
- SendCustomNotifications
-
-
- true
- SendSitRequests
-
-
- true
- ShareInternalArticles
-
-
- true
- ShowCompanyNameAsUserBadge
-
-
- true
- SolutionImport
-
-
- true
- SubmitMacrosAllowed
-
-
- true
- SubscribeDashboardRolesGrps
-
-
- true
- SubscribeDashboardToOtherUsers
-
-
- true
- SubscribeReportRolesGrps
-
-
- true
- SubscribeReportToOtherUsers
-
-
- true
- SubscribeReportsRunAsUser
-
-
- true
- SubscribeToLightningDashboards
-
-
- true
- SubscribeToLightningReports
-
-
- true
- TransactionalEmailSend
-
-
- true
- TransferAnyCase
-
-
- true
- TransferAnyEntity
-
-
- true
- TransferAnyLead
-
-
- true
- UseTeamReassignWizards
-
-
- true
- UseWebLink
-
-
- true
- ViewAllData
-
-
- true
- ViewAllProfiles
-
-
- true
- ViewAllUsers
-
-
- true
- ViewDataAssessment
-
-
- true
- ViewDataCategories
-
-
- true
- ViewDeveloperName
-
-
- true
- ViewEventLogFiles
-
-
- true
- ViewFlowUsageAndFlowEventData
-
-
- true
- ViewHealthCheck
-
-
- true
- ViewHelpLink
-
-
- true
- ViewMyTeamsDashboards
-
-
- true
- ViewPublicDashboards
-
-
- true
- ViewPublicReports
-
-
- true
- ViewRoles
-
-
- true
- ViewSetup
-
-
- true
- ViewTrustMeasures
-
-
- true
- ViewUserPII
-
diff --git a/package.json b/package.json
index 7f9429323..bd6cee0a3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "nebula-logger",
- "version": "4.7.5",
+ "version": "4.7.6",
"description": "Designed for Salesforce admins, developers & architects. A robust logger for Apex, Flow, Process Builder & Integrations.",
"author": "Jonathan Gillespie",
"license": "MIT",
diff --git a/sfdx-project.json b/sfdx-project.json
index eedaf7681..91e49d1c7 100644
--- a/sfdx-project.json
+++ b/sfdx-project.json
@@ -12,9 +12,9 @@
"package": "Nebula Logger - Core",
"path": "./nebula-logger/core",
"definitionFile": "./config/scratch-orgs/base-scratch-def.json",
- "versionNumber": "4.7.5.NEXT",
- "versionName": "Configurable Logger.setScenario() Behavior",
- "versionDescription": "Added new LoggerParameter__mdt record UseFirstSpecifiedScenario to control if the first or last scenario specified is used",
+ "versionNumber": "4.7.6.NEXT",
+ "versionName": "Support for Component Logging of Apex Controller Errors",
+ "versionDescription": "Added support for logging in LWC/Aura of error objects returned from Apex controller methods (which have a different structure from a native JavaScript Error)",
"releaseNotesUrl": "https://github.com/jongpie/NebulaLogger/releases",
"default": true
},
@@ -125,7 +125,8 @@
"Nebula Logger - Core@4.7.2-1-parent-log-transaction-id-bugfix": "04t5Y0000015lhdQAA",
"Nebula Logger - Core@4.7.3-2-query-selector-classes": "04t5Y0000015liHQAQ",
"Nebula Logger - Core@4.7.4-3-new-method-logger.logdatabaseerrors()": "04t5Y0000015ligQAA",
- "Nebula Logger - Core@4.7.5-NEXT-configurable-logger.setscenario()-behavior": "04t5Y0000015lkcQAA",
+ "Nebula Logger - Core@4.7.5-3-configurable-logger.setscenario()-behavior": "04t5Y0000015lkcQAA",
+ "Nebula Logger - Core@4.7.6-NEXT-support-for-component-logging-of-apex-controller-errors": "04t5Y0000015lkmQAA",
"Nebula Logger - Plugin - Async Failure Additions": "0Ho5Y000000blO4SAI",
"Nebula Logger - Plugin - Async Failure Additions@1.0.0-3": "04t5Y0000015lhiQAA",
"Nebula Logger - Plugin - Async Failure Additions@1.0.1-1": "04t5Y0000015lhsQAA",