SalesforceCommerceCloud / pwa-kit

React-based JavaScript frontend framework to create a progressive web app (PWA) storefront for Salesforce B2C Commerce.
https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/pwa-kit-overview.html
BSD 3-Clause "New" or "Revised" License
283 stars 130 forks source link

Consistent logs - Part 2 using logger (@W-15832306@) #1828

Closed adamraya closed 3 months ago

adamraya commented 3 months ago

Description

Follow-up PR from https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1822 Replacing all the console statements in PWA Kit packages with the equivalent logger.

Types of Changes

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

How to Test-Drive This PR

Checklists

General

Accessibility Compliance

You must check off all items in one of the follow two lists:

or...

Localization

vmarta commented 3 months ago

@adamraya how about the console warnings from commerce-sdk-react? The package has no dependency on pwa-kit-dev, so we probably don't want to import its logger in this case. https://github.com/SalesforceCommerceCloud/pwa-kit/blob/c8aa0c0525a9e6e3292dc01fdd36d8c80dd26387/packages/commerce-sdk-react/src/auth/index.ts#L405-L409

But perhaps we can make CommerceApiProvider to receive an optional logger instance? If the logger is provided, then commerce-sdk-react would use it. Otherwise, fall back to console.warn.