-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: in dev mode pretty-print multi-line strings in logs (#19266)
Now in dev mode we're using `formatWithOptions()` instead of `JSON.stringify()`. So now the output in the console in dev mode is more human-readable (including multi-line strings). **QA steps**: 1. in app.module.ts provide the following config chunk (causing HTTP call to backend to fail): ```ts provideConfig({ backend: { occ: { endpoints: { components: 'some-fake-endpoint', }, }, }, }), ``` 2. start SSR server - run `npm run dev:ssr` 3. in another terminal `curl http://localhost:4200` 4. In the logs of the SSR server, see the error message is now multi-line human-readable format. Also function's definitions in the `[spartacus] SSR optimization engine initialized` are also multi-line. BEFORE (dev mode only screenshots): ![image](https://github.com/user-attachments/assets/ab8f02a6-5f26-4605-8f96-5a7d8ad91f11) ![image](https://github.com/user-attachments/assets/fb9f192f-f3c4-43c3-998e-9481c8bf86e2) ![image](https://github.com/user-attachments/assets/4bb7f5c1-410d-4f5d-b9cb-75a7998953fb) AFTER: a) DEV MODE: ![image](https://github.com/user-attachments/assets/c419fef7-60ef-4981-8eff-d206ef8e8226) ![image](https://github.com/user-attachments/assets/5243ea4e-c108-42fc-87c0-5388527f1e04) ![image](https://github.com/user-attachments/assets/e17b071e-fce0-4a8e-a543-bcd3463c1f10) b) PROD MODE: ![image](https://github.com/user-attachments/assets/a1e3c104-2232-4d4d-a7ea-c7ade59f2d71) ![image](https://github.com/user-attachments/assets/039d079f-891d-436d-9d99-e8aacd9df10f) ![image](https://github.com/user-attachments/assets/031668b9-0451-48d6-ad97-596c2417bfb1) fixes https://jira.tools.sap/browse/CXSPA-8385
- Loading branch information
Showing
3 changed files
with
129 additions
and
139 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
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