-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move logger options to Hydrogen config (#1403)
* Stop using globalThis for logger and minor refactor * Move logger options to Hydrogen config file * Update unit tests * Remove setLogger call from e2e tests * Always call setLogger for HMR * Remove unnecessary type * Add docs * Changeset * Fix link * Apply suggestions from code review Co-authored-by: Michelle Vinci <[email protected]> Co-authored-by: Michelle Vinci <[email protected]>
- Loading branch information
Showing
18 changed files
with
151 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
'@shopify/hydrogen': minor | ||
--- | ||
|
||
The `setLogger` and `setLoggerOptions` utilities have been removed. The same information can now be passed under the `logger` property in Hydrogen config: | ||
|
||
```diff | ||
// App.server.jsx | ||
|
||
-import {setLogger, setLoggerOptions} from '@shopify/hydrogen'; | ||
|
||
-setLogger({ | ||
- trace() {}, | ||
- error() {}, | ||
- // ... | ||
-}); | ||
|
||
-setLoggerOptions({ | ||
- showQueryTiming: true, | ||
- showCacheControlHeader: true, | ||
- // ... | ||
-}); | ||
|
||
function App() { | ||
// ... | ||
} | ||
|
||
export default renderHydrogen(App); | ||
``` | ||
|
||
```diff | ||
// hydrogen.config.js | ||
|
||
export default defineConfig({ | ||
// ... | ||
+ logger: { | ||
+ trace() {}, | ||
+ error() {}, | ||
+ showQueryTiming: true, | ||
+ showCacheControlHeader: true, | ||
+ // ... | ||
+ }, | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.