Skip to content

Commit 255c27c

Browse files
authored
Merge pull request #1353 from nrkno/fix/sofie-3679/pogw-log-output
2 parents 4253eea + 0d2b844 commit 255c27c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

packages/live-status-gateway/src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ const myFormat = combine(
1212
splat(),
1313
printf((obj) => {
1414
obj.localTimestamp = new Date().toISOString()
15+
// Prevent errors and other objects to be inserted as Objects into message field
16+
if (typeof obj.message === 'object') {
17+
if (obj.message instanceof Error) {
18+
const errorObj = obj.message
19+
obj.message = errorObj.message
20+
obj.details = errorObj
21+
} else {
22+
obj.message = JSON.stringify(obj.message)
23+
}
24+
}
1525
return JSON.stringify(obj) // make single line
1626
})
1727
)

packages/playout-gateway/src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ const myFormat = combine(
1212
splat(),
1313
printf((obj) => {
1414
obj.localTimestamp = new Date().toISOString()
15+
// Prevent errors and other objects to be inserted as Objects into message field
16+
if (typeof obj.message === 'object') {
17+
if (obj.message instanceof Error) {
18+
const errorObj = obj.message
19+
obj.message = errorObj.message
20+
obj.details = errorObj
21+
} else {
22+
obj.message = JSON.stringify(obj.message)
23+
}
24+
}
1525
return JSON.stringify(obj) // make single line
1626
})
1727
)

0 commit comments

Comments
 (0)