Skip to content

Commit c87c89a

Browse files
authored
Pass extra args to error log (#2533)
* pass extra args to error log * add changeset * prettier
1 parent 2db2290 commit c87c89a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.changeset/smooth-plate-june.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/hydrogen': patch
3+
---
4+
5+
Log extra params in default error logger

packages/hydrogen/src/utilities/log/log.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,14 @@ const defaultLogger: Logger = {
4343
},
4444
error(context, error, ...extra) {
4545
const url = context ? ` ${context.url}` : '';
46+
const extraMessage = extra.length ? `\n${extra.join('\n')}` : '';
4647

4748
if (error instanceof Error) {
48-
console.error(red(`Error processing route:${url}\n${error.stack}`));
49+
console.error(
50+
red(`Error processing route:${url}\n${error.stack}${extraMessage}`)
51+
);
4952
} else {
50-
console.error(red(`Error:${url} ${error}`));
53+
console.error(red(`Error:${url} ${error}${extraMessage}`));
5154
}
5255
},
5356
fatal(context, ...args) {

0 commit comments

Comments
 (0)