Skip to content

Commit

Permalink
Merge pull request #1353 from nrkno/fix/sofie-3679/pogw-log-output
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarpl authored Jan 8, 2025
2 parents 4253eea + 0d2b844 commit 255c27c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/live-status-gateway/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ const myFormat = combine(
splat(),
printf((obj) => {
obj.localTimestamp = new Date().toISOString()
// Prevent errors and other objects to be inserted as Objects into message field
if (typeof obj.message === 'object') {
if (obj.message instanceof Error) {
const errorObj = obj.message
obj.message = errorObj.message
obj.details = errorObj
} else {
obj.message = JSON.stringify(obj.message)
}
}
return JSON.stringify(obj) // make single line
})
)
Expand Down
10 changes: 10 additions & 0 deletions packages/playout-gateway/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ const myFormat = combine(
splat(),
printf((obj) => {
obj.localTimestamp = new Date().toISOString()
// Prevent errors and other objects to be inserted as Objects into message field
if (typeof obj.message === 'object') {
if (obj.message instanceof Error) {
const errorObj = obj.message
obj.message = errorObj.message
obj.details = errorObj
} else {
obj.message = JSON.stringify(obj.message)
}
}
return JSON.stringify(obj) // make single line
})
)
Expand Down

0 comments on commit 255c27c

Please sign in to comment.